home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
network
/
samba
/
patches
/
samba-1.028
/
samba-1
Wrap
Text File
|
1995-09-15
|
117KB
|
3,965 lines
diff -u -r --new-file last-version/docs/MIRRORS samba-1.9.14alpha17/docs/MIRRORS
--- last-version/docs/MIRRORS Sun Jun 4 15:39:15 1995
+++ samba-1.9.14alpha17/docs/MIRRORS Fri Sep 15 19:02:39 1995
@@ -7,6 +7,8 @@
ftp://ftp.demon.co.uk/pub/unix/samba
ftp://sunsite.unc.edu/pub/Linux/system/Network/Samba/
ftp://ftp.choc.apana.org.au/pub/samba
+ftp://ftp.uni-trier.de/pub/unix/network/samba/
+
There are several others. Give archie a try.
diff -u -r --new-file last-version/docs/README.jis samba-1.9.14alpha17/docs/README.jis
--- last-version/docs/README.jis Sat Dec 10 15:57:14 1994
+++ samba-1.9.14alpha17/docs/README.jis Fri Sep 15 20:17:28 1995
@@ -1,8 +1,8 @@
-$B!|(B samba $B4A;zBP1~$K$D$$$F(B
+$B!|(B samba $BF|K\8lBP1~$K$D$$$F(B
-0. $BL\E*(B
+1. $BL\E*(B
- $B4A;zBP1~$N<g$JL\E*$O!"(B
+ $BF|K\8lBP1~$O!"(B
(1) MS-Windows $B>e$G!"4A;z%U%!%$%kL>$r$I$&$7$F$b07$&I,MW$N$"$k%"%W%j%1!<%7%g%s$,$A$c(B
$B$s$HF0:n$9$k!#Nc$($P!"(BMS-WORD 5 $B$J$I$O!"%$%s%9%H!<%k;~$K4A;z$N%U%!%$%kL>$r>!<j(B
@@ -10,10 +10,12 @@
(2) UNIX $B$O!":G6a$G$O$[$H$s$I$N$b$N$,(B 8 bits $B$N%U%!%$%kL>$r%5%]!<%H$7$F$$$^$9$,!"(B
$BCf$K$O!"$3$l$r%5%]!<%H$7$F$$$J$$$b$N$b$"$j$^$9!#$3$N$h$&$J>l9g$G$b!"(B(1)$B$NL\E*(B
- $B$,2L$?$;$k$h$&$K$9$k!#(B
+ $B$,K~B-$G$-$k$h$&$K$9$k!#(B
-1. $BMxMQJ}K!(B
+ $B$rL\E*$H$7$F$$$^$9!#$=$N$?$a!"F|K\8lBP1~$O!"I,MW:G>.8B$7$+9T$J$C$F$*$j$^$;$s!#(B
+2. $BMxMQJ}K!(B
+
(1) $BDI2C$7$?%Q%i%a!<%?(B
smb.conf $B%U%!%$%k$N(B global $B%;%/%7%g%s$K0J2<$N%Q%i%a!<%?$r@_Dj$G$-$k$h$&$K$7$^$7$?!#(B
@@ -27,27 +29,43 @@
sjis: SHIFT JIS (MS $B4A;z%3!<%I(B)
euc: EUC $B%3!<%I(B
- jis7: 7 bits JIS $B%3!<%I$G$9!#%7%U%H%3!<%I$O!"$=$l$>$l!"0J2<$NDL$j$G$9!#(B
- $B4A;z$N;O$^$j(B: \E $ B $B$+(B \E $ @
- $B4A;z$N=*$j(B: \E ( J $B$+(B \E ( B $B$+(B \E ( H
- $B$3$l$i$O!"$9$G$KB8:_$7$F$$$k%U%!%$%kL>$NCf$NJ8;z%3!<%I$rFI$_9~$`;~$K;H$$$^(B
- $B$9!#?7$7$$%U%!%$%k$r:n$k;~$O!"%G%U%)%k%H$G!"(B
- $B4A;z$N;O$^$j(B: \E $ B
- $B4A;z$N=*$j(B: \E ( J
- $B$G$9!#%3%s%Q%$%k$N%*%W%7%g%s$GJQ992DG=$G$9!#(B
- $B$^$?!"H>3Q%+%?%+%J$O!"(B
- $BH>3Q%+%?%+%J3+;O(B: 0x0e
- $BH>3Q%+%?%+%J=*N;(B: 0x0f
- $B$G$9!#(B
- jis8: 8 bits JIS $B%3!<%I$G$9!#4A;z$N$?$a$N%7%U%H%3!<%I$O(B jis7 $B$HF1$8$G$9!#H>3Q%+%?(B
- $B%+%J$K$O%7%U%H%3!<%I$O$D$-$^$;$s!#(B
- junet: jis7 $B$NH>3Q%+%?%+%J$N%7%U%H%3!<%I$,0J2<$N$h$&$KJQ$o$k0J30!"(Bjis7 $B$HF1$8$G$9!#(B
- $BH>3Q%+%?%+%J3+;O(B: \E ( I
- $BH>3Q%+%?%+%J=*N;(B: $B4A;z$N=*$j$HF1$8(B
hex: 7 bits $B$N(B ASCII $B%3!<%I0J30$N%3!<%I$r0J2<$N7A<0$GI=$9J}<0$G$9!#Nc$($P!"(B
'$B%*%U%#%9(B' $B$H$$$&L>A0$O!"(B':83:49:83:74:83:42:83:58' $B$N$h$&$K!"(B':' $B$N8e$K#27e(B
$B$N(B16$B?J?t$rB3$1$k7A<0$K$J$j$^$9!#(B
-
+ $B$3$3$G!"(B':' $B$rB>$NJ8;z$KJQ99$7$?$$>l9g$O!"(Bhex $B$N8e$m$K$=$NJ8;z$r;XDj$7$^$9!#(B
+ $BNc$($P!"(B@$B$rJQ$o$j$K;H$$$?$$>l9g$O!"(B'hex@'$B$N$h$&$K;XDj$7$^$9!#(B
+ JIS $B%3!<%I$K$D$$$F$O!"0J2<$NI=$r;2>H$7$F2<$5$$!#(B
+ $B(#(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(((!(!(!(!(!(!(!(!(!($(B
+ $B(";XDj(B $B("4A;z3+;O("4A;z=*N;("%+%J3+;O("%+%J=*N;("1Q?t3+;O("Hw9M(B $B("(B
+ $B('(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(+(!(!(!(!(!(!(!(!(!()(B
+ $B("(Bjis7 $B("(B\E$B $B("(B\E(J $B("(B0x0e $B("(B0x0f $B("(B\E(J $B("(Bjis 7$BC10LId9f(B $B("(B
+ $B("(Bjunet $B("(B\E$B $B("(B\E(J $B("(B\E(I $B("(B\E(J $B("(B\E(J $B("(B7bits $B%3!<%I(B $B("(B
+ $B("(Bjis8 $B("(B\E$B $B("(B\E(J $B("(B-- $B("(B-- $B("(B\E(J $B("(Bjis 8$BC10LId9f(B $B("(B
+ $B("(Bj7bb $B("(B\E$B $B("(B\E(B $B("(B0x0e $B("(B0x0f $B("(B\E(B $B("(B $B("(B
+ $B("(Bj7bj $B("(B\E$B $B("(B\E(J $B("(B0x0e $B("(B0x0f $B("(B\E(J $B("(Bjis7$B$HF1$8(B $B("(B
+ $B("(Bj7bh $B("(B\E$B $B("(B\E(H $B("(B0x0e $B("(B0x0f $B("(B\E(H $B("(B $B("(B
+ $B("(Bj7@b $B("(B\E$@ $B("(B\E(B $B("(B0x0e $B("(B0x0f $B("(B\E(B $B("(B $B("(B
+ $B("(Bj7@j $B("(B\E$@ $B("(B\E(J $B("(B0x0e $B("(B0x0f $B("(B\E(J $B("(B $B("(B
+ $B("(Bj7@h $B("(B\E$@ $B("(B\E(H $B("(B0x0e $B("(B0x0f $B("(B\E(H $B("(B $B("(B
+ $B("(Bj8bb $B("(B\E$B $B("(B\E(B $B("(B-- $B("(B-- $B("(B\E(B $B("(B $B("(B
+ $B("(Bj8bj $B("(B\E$B $B("(B\E(J $B("(B-- $B("(B-- $B("(B\E(J $B("(Bjis8$B$HF1$8(B $B("(B
+ $B("(Bj8bh $B("(B\E$B $B("(B\E(H $B("(B-- $B("(B-- $B("(B\E(H $B("(B $B("(B
+ $B("(Bj8@b $B("(B\E@@ $B("(B\E(B $B("(B-- $B("(B-- $B("(B\E(B $B("(B $B("(B
+ $B("(Bj8@j $B("(B\E$@ $B("(B\E(J $B("(B-- $B("(B-- $B("(B\E(J $B("(B $B("(B
+ $B("(Bj8@h $B("(B\E$@ $B("(B\E(H $B("(B-- $B("(B-- $B("(B\E(H $B("(B $B("(B
+ $B("(Bjubb $B("(B\E$B $B("(B\E(B $B("(B\E(I $B("(B\E(B $B("(B\E(B $B("(B $B("(B
+ $B("(Bjubj $B("(B\E$B $B("(B\E(J $B("(B\E(I $B("(B\E(J $B("(B\E(J $B("(Bjunet$B$HF1$8(B $B("(B
+ $B("(Bjubh $B("(B\E$B $B("(B\E(H $B("(B\E(I $B("(B\E(H $B("(B\E(H $B("(B $B("(B
+ $B("(Bju@b $B("(B\E$@ $B("(B\E(B $B("(B\E(I $B("(B\E(B $B("(B\E(B $B("(B $B("(B
+ $B("(Bju@j $B("(B\E$@ $B("(B\E(J $B("(B\E(I $B("(B\E(J $B("(B\E(J $B("(B $B("(B
+ $B("(Bju@h $B("(B\E$@ $B("(B\E(H $B("(B\E(I $B("(B\E(H $B("(B\E(H $B("(B $B("(B
+ $B(&(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(*(!(!(!(!(!(!(!(!(!(%(B
+
+ $B$$$:$l$N>l9g$b!"$9$G$KB8:_$7$F$$$kL>A0$KBP$7$F$O!"4A;z$N3+;O=*N;%7!<%1%s%9$O!"0J2<(B
+ $B$N$b$N$rG'<1$7$^$9!#(B
+ $B4A;z$N;O$^$j(B: \E$B $B$+(B \E$@
+ $B4A;z$N=*$j(B: \E(J $B$+(B \E(B $B$+(B \E(H
+
(2) smbclient $B$N%*%W%7%g%s(B
$B%/%i%$%"%s%H%W%m%0%i%`$G$b!"4A;z$d2>L>$r4^$s$@%U%!%$%k$r07$($k$h$&$K!"<!$N%*%W%7%g%s(B
@@ -61,25 +79,17 @@
$B%G%U%)%k%H$N%3!<%I7O$O!"%3%s%Q%$%k;~$K7h$^$j$^$9!#(B
-2. $B%3%s%Q%$%k;~$N@_Dj(B
+3. $B%3%s%Q%$%k;~$N@_Dj(B
Makefile $B$K@_Dj$9$k9`L\$r0J2<$K<($7$^$9!#(B
(1) KANJI $B%U%i%0(B
- $B%3%s%Q%$%k%*%W%7%g%s$K(B -DKANJI=\"$B%3!<%I7O(B\" $B$r;XDj$7$^$9!#$3$N%3!<%I7O$O(B 1. $B$G;X(B
+ $B%3%s%Q%$%k%*%W%7%g%s$K(B -DKANJI=\"$B%3!<%I7O(B\" $B$r;XDj$7$^$9!#$3$N%3!<%I7O$O(B 2. $B$G;X(B
$BDj$9$k$b$N$HF1$8$G$9!#Nc$($P!"(B-DKANJI=\"euc\" $B$r(BFLAGSM $B$K@_Dj$9$k$H(B UNIX $B>e$N%U%!(B
$B%$%kL>$O!"(BEUC $B%3!<%I$K$J$j$^$9!#$3$3$G;XDj$7$?%3!<%I7O$O!"%5!<%P5Z$S%/%i%$%"%s%H(B
$B%W%m%0%i%`$N%G%U%)%k%H$KCM$J$j$^$9!#(B
-(2) JIS $B%3!<%IMQ%7%U%H%3!<%I(B
-
- -DJIS_KSO=\'@\' $B4A;z%3!<%I$N3+;O%7!<%1%s%9$r(B \E$@ $B$KJQ99$7$^$9!#(B
- -DJIS_KSI=\'B\' $B4A;z%3!<%I$N=*N;%7!<%1%s%9$r(B \E(B $B$KJQ99$7$^$9!#(B
-
- $B$N$h$&$K%G%U%)%k%H$N4A;z$N%7%U%H%3!<%I$rJQ99$9$k$3$H$,$G$-$^$9!#$3$N%7!<%1%s%9$O!"?7(B
- $B$7$$%U%!%$%k$r:n$k$H$-$J$I$KMQ$$$^$9!#(B
-
3. $B@)8B;v9`(B
(1) $B4A;z%3!<%I(B
@@ -94,7 +104,13 @@
$B$A$c$s$H$7$?%9%Z%C%/$,$h$/$o$+$i$J$+$C$?$N$G$9$,!"0l1~!"(BDOS/V $B$NF0:n$HF1$8F0:n$r9T$J(B
$B$&$h$&$K$J$C$F$$$^$9!#(B
-4. $B$=$NB>(B
+4. $B>c32Ey$N%l%]!<%H$K$D$$$F(B
+
+ $BF|K\8l$N%U%!%$%kL>$K4X$7$F!"J8;z2=$1Ey$N>c32$,$"$l$P!";d$K%l%]!<%H$7$FD:$1$l$P9,$$$G(B
+$B$9!#$?$@$7!"%*%j%8%J%k$+$i$NLdBjE@$d<ALd$K$D$$$F$O!"%*%j%8%J%k$N:n<T$XD>@\Ld$$9g$o$;$k(B
+$B$+!"$b$7$/$O%a!<%j%s%0%j%9%H$J$I$X%l%]!<%H$9$k$h$&$K$7$F2<$5$$!#(B
+
+5. $B$=$NB>(B
hex $B7A<0$NJQ495Z$S(BUNIX $B>e$G$N%U%!%$%kL>$NJQ49J}K!$O!"(B
@@ -102,6 +118,7 @@
$B$,:n$i$l$?%3!<%I$rMxMQ$7$F$$$^$9!#(B
-1994$BG/(B10$B7n(B28$BF|(B
+1994$BG/(B10$B7n(B28$BF|(B $BBh#1HG(B
+1995$BG/(B 8$B7n(B16$BF|(B $BBh#2HG(B
$BF#ED(B $B?r(B fujita@ainix.isac.co.jp
diff -u -r --new-file last-version/docs/smb.conf.5 samba-1.9.14alpha17/docs/smb.conf.5
--- last-version/docs/smb.conf.5 Tue Sep 12 22:57:45 1995
+++ samba-1.9.14alpha17/docs/smb.conf.5 Thu Sep 14 09:57:46 1995
@@ -1929,7 +1929,7 @@
This options controls whether Samba will allow a previously validated
username/password pair to be used to attach to a share. Thus if you
-connect to \\server\share1 then to \\server\share2 it won't
+connect to \\\\server\\share1 then to \\\\server\\share2 it won't
automatically allow the client to request connection to the second
share as the same username as the first without a password.
@@ -2320,12 +2320,12 @@
You can have as many mappings as you like in a username map file.
Note that the remapping is applied to all occurances of
-usernames. Thus if you connect to "\\server\fred" and "fred" is
+usernames. Thus if you connect to "\\\\server\\fred" and "fred" is
remapped to "mary" then you will actually be connecting to
-"\\server\mary" and will need to supply a password suitable for "mary"
-not "fred". The only exception to this is the username passwed to the
-"password server" (if you have one). The password server will receive
-whatever username the client supplies without modification.
+"\\\\server\\mary" and will need to supply a password suitable for
+"mary" not "fred". The only exception to this is the username passwed
+to the "password server" (if you have one). The password server will
+receive whatever username the client supplies without modification.
Also note that no reverse mapping is done. The main effect this has is
with printing. Users who have been mapped may have trouble deleting
diff -u -r --new-file last-version/source/Makefile samba-1.9.14alpha17/source/Makefile
--- last-version/source/Makefile Tue Sep 12 16:19:01 1995
+++ samba-1.9.14alpha17/source/Makefile Fri Sep 15 20:20:29 1995
@@ -122,21 +122,17 @@
#####################################
# for the JAPANESE EXTENSION
# select filename's code set for KANJI/KANA in UNIX,
-# apply apply following flag
+# apply the following flag
# -DKANJI=\"<code>\"
# <code> is select character code set for JAPAN.
# sjis: if your machine support SJIS
# euc: if your machine support EUC
# jis7: if your machine support JIS7
-# KANA: SO = 0x0e, SI = 0x0f
-# KANJI: SO = \E$B or \E$@, SI = \E(J or \E(B or \E(H
# jis8: if your machine support JIS8
-# KANJI: SO = \E$B or \E$@, SI = \E(J or \E(B or \E(H
# junet: if your machine support jis7 + junet rule
-# KANA: SO = \E(I, SI = \E(J or \E(B or \E(H
-# KANJI: SO = \E$B or \E$@, SI = \E(J or \E(B or \E(H
# hex: if your machine only support 7 bits ascii filename only
# convert to hexdecimal code preseeding ':'.
+# see also README.jis
######################################
@@ -408,6 +404,10 @@
# FLAGSM= -DCONVEX -DSHADOW_PWD
# LIBSM=
+# This is for SMP_DC.OSx v1.1-94c079 on Pyramid S series
+# contributed by jeffrey@itm.org
+# FLAGSM = -DSOLARIS -DSHADOW_PWD -DBSD_COMP
+# LIBSM = -lsocket -lnsl
######################################################################
diff -u -r --new-file last-version/source/change-log samba-1.9.14alpha17/source/change-log
--- last-version/source/change-log Thu Sep 14 00:11:34 1995
+++ samba-1.9.14alpha17/source/change-log Fri Sep 15 21:40:11 1995
@@ -1554,7 +1554,28 @@
- fixed fcb open permissions (should mean apps know when a file is
read only)
- released alpha16
+ - client help formatting fix and docs fix from Peter Jones
+ <thanatos@drealm.org>
+ - added a directory cache
+ - use /proc whenever possible for pid detection
+ - TCSANOW fix in getsmbpasswd from roderich@nodebonn.muc.bmw.de
+ - fixed default printing mode for sysv systems
+ - make client always expand mask
+ - more minor IPC fixups
+ - pyramid makefile entry from jeffrey@itm.org
+ - client fixups for passlen, maxvcs and session redirect from
+ Charles Hoch <hoch@hplcgh.hpl.hp.com>
+ - finally fixed important IPC bug (varargs bug with int16)
+ - quota patches from Dirk.DeWachter@rug.ac.be
+ - print queue cache changes (per service) and print queue priority
+ additions from Dirk.DeWachter@rug.ac.be
+ - new japanese patches (incomplete) from
+ fujita@ainix.isac.co.jp (Takashi Fujita)
+ - moved a lot more functions into system.c via wrappers
+ - changed a lot of the connection refused error codes to be more
+ informative (or at least different)
+
==========
todo:
@@ -1584,6 +1605,8 @@
get rid of the silly +4 and -4 by removing NBT stuff
write-only shares
+
+document cnvchar stuff
UNRESOLVED PROBLEMS
===================
diff -u -r --new-file last-version/source/client.c samba-1.9.14alpha17/source/client.c
--- last-version/source/client.c Wed Sep 13 22:47:45 1995
+++ samba-1.9.14alpha17/source/client.c Fri Sep 15 21:05:13 1995
@@ -113,8 +113,8 @@
#ifdef KANJI
extern int coding_system;
-#define CNV_LANG(s) (coding_system == DOSV_CODE?s:kj_unix_format(s, False))
-#define CNV_INPUT(s) (coding_system == DOSV_CODE?s:kj_dos_format(s, True))
+#define CNV_LANG(s) (coding_system == DOSV_CODE?s:dos_to_unix(s, False))
+#define CNV_INPUT(s) (coding_system == DOSV_CODE?s:unix_to_dos(s, True))
static BOOL
setup_term_code (char *code)
{
@@ -936,8 +936,7 @@
strcat(mask,"*");
}
- if (Protocol < PROTOCOL_LANMAN2)
- expand_mask(mask,True);
+ expand_mask(mask,True);
do_dir(inbuf,outbuf,mask,attribute,NULL,recurse);
do_dskattr();
@@ -1426,7 +1425,7 @@
if (lowercase)
strlower(finfo->name);
- if (!directory_exist(finfo->name) && mkdir(finfo->name,0777) != 0)
+ if (!directory_exist(finfo->name) && sys_mkdir(finfo->name,0777) != 0)
{
DEBUG(0,("failed to create directory %s\n",CNV_LANG(finfo->name)));
strcpy(cur_dir,saved_curdir);
@@ -1434,7 +1433,7 @@
return;
}
- if (chdir(finfo->name) != 0)
+ if (sys_chdir(finfo->name) != 0)
{
DEBUG(0,("failed to chdir to directory %s\n",CNV_LANG(finfo->name)));
strcpy(cur_dir,saved_curdir);
@@ -2424,7 +2423,7 @@
struct stat sbuf;
ok = next_token(NULL,buf,NULL);
- if (ok && (stat(buf,&sbuf) == 0))
+ if (ok && (sys_stat(buf,&sbuf) == 0))
{
newer_than = sbuf.st_mtime + GMT_TO_LOCAL*TimeDiff(sbuf.st_mtime);
DEBUG(1,("Getting files newer than %s",asctime(LocalTime(&newer_than,0))));
@@ -2527,7 +2526,7 @@
pstring d;
if (next_token(NULL,buf,NULL))
- chdir(buf);
+ sys_chdir(buf);
DEBUG(2,("the local directory is now %s\n",GetWd(d)));
}
@@ -2559,12 +2558,43 @@
DEBUG(5,("Sent session request\n"));
receive_smb(inbuf,CLIENT_TIMEOUT);
-
+
+ if (CVAL(inbuf,0) == 0x84) /* C. Hoch 9/14/95 Start */
+ {
+ /* For information, here is the response structure.
+ * We do the byte-twiddling to for portability.
+ struct RetargetResponse{
+ unsigned char type;
+ unsigned char flags;
+ int16 length;
+ int32 ip_addr;
+ int16 port;
+ };
+ */
+ extern int Client;
+ int port = (CVAL(inbuf,8)<<8)+CVAL(inbuf,9);
+ /* SESSION RETARGET */
+ putip((char *)&dest_ip,inbuf+4);
+
+ close_sockets();
+ Client = open_socket_out(&dest_ip, port);
+ if (Client == -1)
+ return False;
+
+ DEBUG(3,("Retargeted\n"));
+
+ set_socket_options(Client,user_socket_options);
+
+ /* Try again */
+ return send_session_request(inbuf,outbuf);
+ } /* C. Hoch 9/14/95 End */
+
+
if (CVAL(inbuf,0) != 0x82)
{
int ecode = CVAL(inbuf,4);
DEBUG(0,("Session request failed (%d,%d) with myname=%s destname=%s\n",
- CVAL(inbuf,0),ecode,myname,desthost));
+ CVAL(inbuf,0),ecode,myname,desthost));
switch (ecode)
{
case 0x80:
@@ -2608,6 +2638,7 @@
extern int serverzone;
int sec_mode=0;
int crypt_len;
+ int max_vcs=0;
struct {
int prot;
char *name;
@@ -2715,7 +2746,8 @@
crypt_len = smb_buflen(inbuf);
memcpy(cryptkey,smb_buf(inbuf),8);
DEBUG(3,("max mux %d\n",SVAL(inbuf,smb_vwv3)));
- DEBUG(3,("max vcs %d\n",SVAL(inbuf,smb_vwv4)));
+ max_vcs = SVAL(inbuf,smb_vwv4);
+ DEBUG(3,("max vcs %d\n",max_vcs));
DEBUG(3,("max blk %d\n",SVAL(inbuf,smb_vwv5)));
} else {
/* NT protocol */
@@ -2730,7 +2762,8 @@
if (IVAL(inbuf,smb_vwv9+1) & 1)
readbraw_supported = writebraw_supported = True;
DEBUG(3,("max mux %d\n",SVAL(inbuf,smb_vwv1+1)));
- DEBUG(3,("max vcs %d\n",SVAL(inbuf,smb_vwv2+1)));
+ max_vcs = SVAL(inbuf,smb_vwv2+1);
+ DEBUG(3,("max vcs %d\n",max_vcs));
DEBUG(3,("max raw %d\n",IVAL(inbuf,smb_vwv5+1)));
DEBUG(3,("capabilities 0x%x\n",IVAL(inbuf,smb_vwv9+1)));
}
@@ -2776,7 +2809,7 @@
#endif
/* if in share level security then don't send a password now */
- if (!(sec_mode & 1)) passlen=0;
+ if (!(sec_mode & 1)) {strcpy(pword, "");passlen=1;}
/* send a session setup command */
bzero(outbuf,smb_size);
@@ -2789,7 +2822,7 @@
CVAL(outbuf,smb_vwv0) = 0xFF;
SSVAL(outbuf,smb_vwv2,max_xmit);
SSVAL(outbuf,smb_vwv3,2);
- SSVAL(outbuf,smb_vwv4,getpid());
+ SSVAL(outbuf,smb_vwv4,max_vcs-1);
SIVAL(outbuf,smb_vwv5,sesskey);
SSVAL(outbuf,smb_vwv7,passlen);
p = smb_buf(outbuf);
@@ -2880,7 +2913,7 @@
again2:
{
- int passlen = strlen(pass);
+ int passlen = strlen(pass)+1;
fstring pword;
strcpy(pword,pass);
@@ -2893,7 +2926,7 @@
/* if in user level security then don't send a password now */
if ((sec_mode & 1)) {
- passlen=0;
+ strcpy(pword, ""); passlen=1;
}
set_message(outbuf,4,2 + strlen(service) + passlen + strlen(dev),True);
@@ -3301,7 +3334,7 @@
****************************************************************************/
void cmd_help(void)
{
- int i=0;
+ int i=0,j;
fstring buf;
if (next_token(NULL,buf,NULL))
@@ -3316,8 +3349,11 @@
else
while (commands[i].description)
{
- DEBUG(0,("%s\n",commands[i].name));
- i++;
+ for (j=0; commands[i].description && (j<5); j++) {
+ DEBUG(0,("%-15s",commands[i].name));
+ i++;
+ }
+ DEBUG(0,("\n"));
}
}
diff -u -r --new-file last-version/source/clitar.c samba-1.9.14alpha17/source/clitar.c
--- last-version/source/clitar.c Fri Jul 7 15:13:34 1995
+++ samba-1.9.14alpha17/source/clitar.c Fri Sep 15 20:24:05 1995
@@ -207,8 +207,27 @@
* to lovely unix /'s :-} */
*tptr++='.';
-
+#ifdef KANJI
+ while (l > 0) {
+ if (is_shift_jis (*fp)) {
+ *tptr++ = *fp++;
+ *tptr++ = *fp++;
+ l -= 2;
+ } else if (is_kana (*fp)) {
+ *tptr++ = *fp++;
+ l--;
+ } else if (*fp == '\\') {
+ *tptr++ = '/';
+ fp++;
+ l--;
+ } else {
+ *tptr++ = *fp++;
+ l--;
+ }
+ }
+#else
while (l--) { *tptr=(*fp == '\\') ? '/' : *fp; tptr++; fp++; }
+#endif
}
static void oct_it (register long value, register int ndgs, register char *p)
@@ -846,7 +865,27 @@
if (*fp == '.') fp++;
if (*fp == '\\' || *fp == '/') fp++;
+#ifdef KANJI
+ while (l > 0) {
+ if (is_shift_jis (*fp)) {
+ *tptr++ = *fp++;
+ *tptr++ = *fp++;
+ l -= 2;
+ } else if (is_kana (*fp)) {
+ *tptr++ = *fp++;
+ l--;
+ } else if (*fp == '/') {
+ *tptr++ = '\\';
+ fp++;
+ l--;
+ } else {
+ *tptr++ = *fp++;
+ l--;
+ }
+ }
+#else
while (l--) { *tptr=(*fp == '/') ? '\\' : *fp; tptr++; fp++; }
+#endif
}
static long unoct(char *p, int ndgs)
diff -u -r --new-file last-version/source/dir.c samba-1.9.14alpha17/source/dir.c
--- last-version/source/dir.c Wed Sep 13 22:30:27 1995
+++ samba-1.9.14alpha17/source/dir.c Fri Sep 15 20:59:45 1995
@@ -449,7 +449,7 @@
strcpy(pathreal,path);
strcat(path,fname);
strcat(pathreal,dname);
- if (stat(pathreal,&sbuf) != 0)
+ if (sys_stat(pathreal,&sbuf) != 0)
{
DEBUG(5,("Couldn't stat 1 [%s]\n",path));
continue;
@@ -497,7 +497,7 @@
{
Dir *dirp;
char *n;
- void *p = opendir(name);
+ void *p = sys_opendir(name);
int used=0;
if (!p) return(NULL);
@@ -597,6 +597,89 @@
}
+static int dir_cache_size = 0;
+static struct dir_cache {
+ struct dir_cache *next;
+ struct dir_cache *prev;
+ char *path;
+ char *name;
+ char *dname;
+ int snum;
+} *dir_cache = NULL;
+
+/*******************************************************************
+add an entry to the directory cache
+********************************************************************/
+void DirCacheAdd(char *path,char *name,char *dname,int snum)
+{
+ struct dir_cache *entry = (struct dir_cache *)malloc(sizeof(*entry));
+ if (!entry) return;
+ entry->path = strdup(path);
+ entry->name = strdup(name);
+ entry->dname = strdup(dname);
+ entry->snum = snum;
+ if (!entry->path || !entry->name || !entry->dname) return;
+
+ entry->next = dir_cache;
+ entry->prev = NULL;
+ if (entry->next) entry->next->prev = entry;
+ dir_cache = entry;
+
+ DEBUG(1,("Added dir cache entry %s %s -> %s\n",path,name,dname));
+
+ if (dir_cache_size == DIRCACHESIZE) {
+ for (entry=dir_cache; entry->next; entry=entry->next) ;
+ free(entry->path);
+ free(entry->name);
+ free(entry->dname);
+ if (entry->prev) entry->prev->next = entry->next;
+ free(entry);
+ } else {
+ dir_cache_size++;
+ }
+}
+
+
+/*******************************************************************
+check for an entry in the directory cache
+********************************************************************/
+char *DirCacheCheck(char *path,char *name,int snum)
+{
+ struct dir_cache *entry;
+
+ for (entry=dir_cache; entry; entry=entry->next) {
+ if (entry->snum == snum &&
+ strcmp(path,entry->path) == 0 &&
+ strcmp(name,entry->name) == 0) {
+ DEBUG(1,("Got dir cache hit on %s %s -> %s\n",path,name,entry->dname));
+ return(entry->dname);
+ }
+ }
+
+ return(NULL);
+}
+
+/*******************************************************************
+flush entries in the dir_cache
+********************************************************************/
+void DirCacheFlush(int snum)
+{
+ struct dir_cache *entry,*next;
+
+ for (entry=dir_cache; entry; entry=next) {
+ if (entry->snum == snum) {
+ free(entry->path);
+ free(entry->dname);
+ free(entry->name);
+ next = entry->next;
+ if (entry->prev) entry->prev->next = entry->next;
+ if (entry->next) entry->next->prev = entry->prev;
+ free(entry);
+ } else {
+ next = entry->next;
+ }
+ }
+}
#ifdef REPLACE_GETWD
diff -u -r --new-file last-version/source/getsmbpass.c samba-1.9.14alpha17/source/getsmbpass.c
--- last-version/source/getsmbpass.c Sun Sep 10 23:28:46 1995
+++ samba-1.9.14alpha17/source/getsmbpass.c Thu Sep 14 12:25:43 1995
@@ -46,6 +46,10 @@
#define TCSAFLUSH 1
#endif
+#ifndef TCSANOW
+#define TCSANOW 0
+#endif
+
int tcgetattr(int fd, struct termio *t)
{
return ioctl(fd, TCGETA, t);
@@ -148,7 +152,7 @@
/* Restore echoing. */
if (echo_off)
- (void) tcsetattr (fileno (in), 0, &t);
+ (void) tcsetattr (fileno (in), TCSANOW, &t);
if (in != stdin)
/* We opened the terminal; now close it. */
diff -u -r --new-file last-version/source/includes.h samba-1.9.14alpha17/source/includes.h
--- last-version/source/includes.h Tue Sep 12 16:21:44 1995
+++ samba-1.9.14alpha17/source/includes.h Fri Sep 15 20:28:21 1995
@@ -67,6 +67,7 @@
#define NO_NETIFH
#define NO_RESOURCEH
#define PRIME_NMBD 0
+#define NO_SETGROUPS
#endif
@@ -251,7 +252,6 @@
#define REPLACE_STRLEN
#define USE_STATVFS
#define USE_GETCWD
-#define DEFAULT_PRINTING PRINT_SYSV
#define USE_SETSID
#endif
@@ -278,7 +278,9 @@
#include <sys/statfs.h>
#include <string.h>
#include <signal.h>
+#ifndef SYSV
#define SYSV
+#endif
#define SIGNAL_CAST (void (*)())
#define STATFS4
#define USE_WAITPID
@@ -352,7 +354,6 @@
#define SIGNAL_CAST (void (*)(int))
#define USE_STATVFS
#define USE_GETCWD
-#define DEFAULT_PRINTING PRINT_SYSV
#endif
@@ -646,7 +647,6 @@
char *strdup (char *);
#define USE_GETCWD
#define NO_FSYNC
-#define DEFAULT_PRINTING PRINT_SYSV
#define NO_EID
#endif
@@ -769,6 +769,8 @@
#define GID_TYPE gid_t
#endif
+
+
/* some unixes have ENOTTY instead of TIOCNOTTY */
#ifndef TIOCNOTTY
#ifdef ENOTTY
@@ -780,10 +782,14 @@
#define SIGHUP 1
#endif
-/* if undefined then use bsd printing */
+/* if undefined then use bsd or sysv printing */
#ifndef DEFAULT_PRINTING
+#ifdef SYSV
+#define DEFAULT_PRINTING PRINT_SYSV
+#else
#define DEFAULT_PRINTING PRINT_BSD
#endif
+#endif
#ifdef AFS_AUTH
@@ -825,12 +831,7 @@
#include "smbpass.h"
#endif
-#ifdef KANJI
-#ifndef _KANJI_C_
#include "kanji.h"
-#endif /* _KANJI_C_ */
-#endif /* KANJI */
-
#include "charset.h"
#ifndef S_IFREG
diff -u -r --new-file last-version/source/ipc.c samba-1.9.14alpha17/source/ipc.c
--- last-version/source/ipc.c Tue Sep 12 15:02:10 1995
+++ samba-1.9.14alpha17/source/ipc.c Fri Sep 15 18:18:44 1995
@@ -37,7 +37,6 @@
extern files_struct Files[];
extern fstring local_machine;
-extern BOOL lpq_cache_reset;
#define NERR_Success 0
#define NERR_badpass 86
@@ -207,7 +206,7 @@
static int get_counter(char** p)
{
int i, n;
- if (!p || !(*p)) return(0);
+ if (!p || !(*p)) return(1);
if (!isdigit(**p)) return 1;
for (n = 0;;) {
i = **p;
@@ -302,7 +301,7 @@
p->curpos = p->format;
else {
p->curpos = p->subformat;
- if (p->subcount) p->subcount--;
+ p->subcount--;
}
}
#if CHECK_TYPES
@@ -324,22 +323,25 @@
switch( *p->curpos++ ) {
case 'W': /* word (2 byte) */
needed = 2;
- temp = va_arg(args,int16);
+ temp = va_arg(args,int);
if (p->buflen >= needed) SSVAL(p->structbuf,0,temp);
break;
case 'N': /* count of substructures (word) at end */
needed = 2;
- p->subcount = va_arg(args,int16);
+ p->subcount = va_arg(args,int);
if (p->buflen >= needed) SSVAL(p->structbuf,0,p->subcount);
break;
case 'D': /* double word (4 byte) */
needed = 4;
- temp = va_arg(args,int32);
+ temp = va_arg(args,int);
if (p->buflen >= needed) SIVAL(p->structbuf,0,temp);
break;
case 'B': /* byte (with optional counter) */
needed = get_counter(&p->curpos);
- if (p->buflen >= needed) StrnCpy(p->structbuf,va_arg(args,char*),needed);
+ {
+ char *s = va_arg(args,char*);
+ if (p->buflen >= needed) StrnCpy(p->structbuf,s?s:"",needed);
+ }
break;
case 'z': /* offset to zero terminated string (4 byte) */
str = va_arg(args,char*);
@@ -370,7 +372,7 @@
SIVAL(p->structbuf,0,0);
else {
SIVAL(p->structbuf,0,PTR_DIFF(p->stringbuf,p->base));
- memcpy(p->stringbuf,str,stringused);
+ memcpy(p->stringbuf,str?str:"",stringused);
if (is_string) p->stringbuf[stringused-1] = '\0';
p->stringbuf += stringused;
p->stringlen -= stringused;
@@ -399,6 +401,17 @@
#define PACKl(desc,t,v,l) package(desc,v,l)
#endif
+static void PACKI(struct pack_desc* desc,char *t,int v)
+{
+ PACK(desc,t,v);
+}
+
+static void PACKS(struct pack_desc* desc,char *t,char *v)
+{
+ PACK(desc,t,v);
+}
+
+
static void PackDriverData(struct pack_desc* desc)
{
char drivdata[4+4+32];
@@ -445,40 +458,40 @@
struct pack_desc* desc,
print_queue_struct* queue, int n)
{
- PACK(desc,"W",((snum%0xFF)<<8) | (queue->job%0xFF)); /* uJobId */
+ PACKI(desc,"W",((snum%0xFF)<<8) | (queue->job%0xFF)); /* uJobId */
if (uLevel == 1) {
- PACK(desc,"B21",queue->user); /* szUserName */
- PACK(desc,"B",""); /* pad */
- PACK(desc,"B16",""); /* szNotifyName */
- PACK(desc,"B10","PM_Q_RAW"); /* szDataType */
- PACK(desc,"z",""); /* pszParms */
- PACK(desc,"W",n+1); /* uPosition */
- PACK(desc,"W",queue->status); /* fsStatus */
- PACK(desc,"z",""); /* pszStatus */
- PACK(desc,"D",queue->time); /* ulSubmitted */
- PACK(desc,"D",queue->size); /* ulSize */
- PACK(desc,"z",queue->file); /* pszComment */
+ PACKS(desc,"B21",queue->user); /* szUserName */
+ PACKS(desc,"B",""); /* pad */
+ PACKS(desc,"B16",""); /* szNotifyName */
+ PACKS(desc,"B10","PM_Q_RAW"); /* szDataType */
+ PACKS(desc,"z",""); /* pszParms */
+ PACKI(desc,"W",n+1); /* uPosition */
+ PACKI(desc,"W",queue->status); /* fsStatus */
+ PACKS(desc,"z",""); /* pszStatus */
+ PACKI(desc,"D",queue->time); /* ulSubmitted */
+ PACKI(desc,"D",queue->size); /* ulSize */
+ PACKS(desc,"z",queue->file); /* pszComment */
}
if (uLevel == 2 || uLevel == 3) {
- PACK(desc,"W",50); /* uPriority */
- PACK(desc,"z",queue->user); /* pszUserName */
- PACK(desc,"W",n+1); /* uPosition */
- PACK(desc,"W",queue->status); /* fsStatus */
- PACK(desc,"D",queue->time); /* ulSubmitted */
- PACK(desc,"D",queue->size); /* ulSize */
- PACK(desc,"z","Samba"); /* pszComment */
- PACK(desc,"z",queue->file); /* pszDocument */
+ PACKI(desc,"W",queue->priority); /* uPriority */
+ PACKS(desc,"z",queue->user); /* pszUserName */
+ PACKI(desc,"W",n+1); /* uPosition */
+ PACKI(desc,"W",queue->status); /* fsStatus */
+ PACKI(desc,"D",queue->time); /* ulSubmitted */
+ PACKI(desc,"D",queue->size); /* ulSize */
+ PACKS(desc,"z","Samba"); /* pszComment */
+ PACKS(desc,"z",queue->file); /* pszDocument */
if (uLevel == 3) {
- PACK(desc,"z",""); /* pszNotifyName */
- PACK(desc,"z","PM_Q_RAW"); /* pszDataType */
- PACK(desc,"z",""); /* pszParms */
- PACK(desc,"z",""); /* pszStatus */
- PACK(desc,"z",SERVICE(snum)); /* pszQueue */
- PACK(desc,"z","lpd"); /* pszQProcName */
- PACK(desc,"z",""); /* pszQProcParms */
- PACK(desc,"z","NULL"); /* pszDriverName */
+ PACKS(desc,"z",""); /* pszNotifyName */
+ PACKS(desc,"z","PM_Q_RAW"); /* pszDataType */
+ PACKS(desc,"z",""); /* pszParms */
+ PACKS(desc,"z",""); /* pszStatus */
+ PACKS(desc,"z",SERVICE(snum)); /* pszQueue */
+ PACKS(desc,"z","lpd"); /* pszQProcName */
+ PACKS(desc,"z",""); /* pszQProcParms */
+ PACKS(desc,"z","NULL"); /* pszDriverName */
PackDriverData(desc); /* pDriverData */
- PACK(desc,"z",""); /* pszPrinterName */
+ PACKS(desc,"z",""); /* pszPrinterName */
}
}
}
@@ -488,52 +501,51 @@
int count, print_queue_struct* queue,
print_status_struct* status)
{
- if (uLevel < 3)
- PACK(desc,"B13",SERVICE(snum));
- else
- PACK(desc,"z",Expand(cnum,snum,SERVICE(snum)));
+ if (uLevel < 3) {
+ PACKS(desc,"B13",SERVICE(snum));
+ } else {
+ PACKS(desc,"z",Expand(cnum,snum,SERVICE(snum)));
+ }
if (uLevel == 1 || uLevel == 2) {
- PACK(desc,"B",""); /* alignment */
- PACK(desc,"W",5); /* priority */
- PACK(desc,"W",0); /* start time */
- PACK(desc,"W",0); /* until time */
- PACK(desc,"z",""); /* pSepFile */
- PACK(desc,"z","lpd"); /* pPrProc */
- PACK(desc,"z",SERVICE(snum)); /* pDestinations */
- PACK(desc,"z",0); /* pParms */
+ PACKS(desc,"B",""); /* alignment */
+ PACKI(desc,"W",5); /* priority */
+ PACKI(desc,"W",0); /* start time */
+ PACKI(desc,"W",0); /* until time */
+ PACKS(desc,"z",""); /* pSepFile */
+ PACKS(desc,"z","lpd"); /* pPrProc */
+ PACKS(desc,"z",SERVICE(snum)); /* pDestinations */
+ PACKS(desc,"z",""); /* pParms */
if (snum < 0) {
- PACK(desc,"z","UNKNOWN PRINTER");
- PACK(desc,"W",LPSTAT_ERROR);
- }
- else if (!status->message[0]) {
- PACK(desc,"z",Expand(cnum,snum,lp_comment(snum)));
- PACK(desc,"W",LPSTAT_OK); /* status */
+ PACKS(desc,"z","UNKNOWN PRINTER");
+ PACKI(desc,"W",LPSTAT_ERROR);
}
- else {
- PACK(desc,"z",status->message);
- PACK(desc,"W",status->status); /* status */
+ else if (!status || !status->message[0]) {
+ PACKS(desc,"z",Expand(cnum,snum,lp_comment(snum)));
+ PACKI(desc,"W",LPSTAT_OK); /* status */
+ } else {
+ PACKS(desc,"z",status->message);
+ PACKI(desc,"W",status->status); /* status */
}
- PACK(desc,(uLevel == 1 ? "W" : "N"),count);
+ PACKI(desc,(uLevel == 1 ? "W" : "N"),count);
}
if (uLevel == 3 || uLevel == 4) {
- PACK(desc,"W",5); /* uPriority */
- PACK(desc,"W",0); /* uStarttime */
- PACK(desc,"W",0); /* uUntiltime */
- PACK(desc,"W",5); /* pad1 */
- PACK(desc,"z",""); /* pszSepFile */
- PACK(desc,"z","lpd"); /* pszPrProc */
- PACK(desc,"z",""); /* pszParms */
- if (!status->message[0]) {
- PACK(desc,"z",Expand(cnum,snum,lp_comment(snum))); /* pszComment */
- PACK(desc,"W",LPSTAT_OK); /* fsStatus */
- }
- else {
- PACK(desc,"z",status->message); /* pszComment */
- PACK(desc,"W",status->status); /* fsStatus */
- }
- PACK(desc,(uLevel == 3 ? "W" : "N"),count); /* cJobs */
- PACK(desc,"z",SERVICE(snum)); /* pszPrinters */
- PACK(desc,"z","NULL"); /* pszDriverName */
+ PACKI(desc,"W",5); /* uPriority */
+ PACKI(desc,"W",0); /* uStarttime */
+ PACKI(desc,"W",0); /* uUntiltime */
+ PACKI(desc,"W",5); /* pad1 */
+ PACKS(desc,"z",""); /* pszSepFile */
+ PACKS(desc,"z","lpd"); /* pszPrProc */
+ PACKS(desc,"z",""); /* pszParms */
+ if (!status || !status->message[0]) {
+ PACKS(desc,"z",Expand(cnum,snum,lp_comment(snum))); /* pszComment */
+ PACKI(desc,"W",LPSTAT_OK); /* fsStatus */
+ } else {
+ PACKS(desc,"z",status->message); /* pszComment */
+ PACKI(desc,"W",status->status); /* fsStatus */
+ }
+ PACKI(desc,(uLevel == 3 ? "W" : "N"),count); /* cJobs */
+ PACKS(desc,"z",SERVICE(snum)); /* pszPrinters */
+ PACKS(desc,"z","NULL"); /* pszDriverName */
PackDriverData(desc); /* pDriverData */
}
if (uLevel == 2 || uLevel == 4) {
@@ -1001,14 +1013,15 @@
char **rdata,char **rparam,
int *rdata_len,int *rparam_len)
{
+ int function = SVAL(param,0);
char *str1 = param+2;
char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
int jobid = (SVAL(p,0)&0xFF); /* the snum and jobid are encoded
by the print queue api */
int snum = (SVAL(p,0)>>8);
+ int i, count;
- lpq_cache_reset = True;
/* check it's a supported varient */
if (!(strcsequal(str1,"W") && strcsequal(str2,"")))
@@ -1020,25 +1033,39 @@
*rdata_len = 0;
SSVAL(*rparam,0,NERR_Success);
- SSVAL(*rparam,2,0); /* converter word */
if (snum >= 0)
{
print_queue_struct *queue=NULL;
- int i;
- int count = get_printqueue(snum,cnum,&queue,NULL);
-
+ lpq_reset(snum);
+ count = get_printqueue(snum,cnum,&queue,NULL);
+
for (i=0;i<count;i++)
- if ((queue[i].job%0xFF) == jobid)
- {
- DEBUG(3,("Deleting queue entry %d\n",queue[i].job));
- del_printqueue(cnum,snum,queue[i].job);
- }
+ if ((queue[i].job%0xFF) == jobid)
+ {
+ switch (function) {
+ case 81: /* delete */
+ DEBUG(3,("Deleting queue entry %d\n",queue[i].job));
+ del_printqueue(cnum,snum,queue[i].job);
+ break;
+ case 82: /* pause */
+ case 83: /* resume */
+ DEBUG(3,("%s queue entry %d\n",
+ (function==82?"pausing":"resuming"),queue[i].job));
+ status_printjob(cnum,snum,queue[i].job,
+ (function==82?LPQ_PAUSED:LPQ_QUEUED));
+ break;
+ }
+ break;
+ }
+
+ if (i==count)
+ SSVAL(*rparam,0,NERR_JobNotFound);
if (queue) free(queue);
}
- DEBUG(3,("Print job delete job=%d snum=%d\n",jobid,snum));
+ SSVAL(*rparam,2,0); /* converter word */
return(True);
}
@@ -1053,8 +1080,6 @@
char *QueueName = skip_string(str2,1);
int snum;
- lpq_cache_reset = True;
-
/* check it's a supported varient */
if (!(strcsequal(str1,"z") && strcsequal(str2,"")))
return(False);
@@ -1078,12 +1103,13 @@
if (snum >= 0) {
print_queue_struct *queue=NULL;
- int i;
- int count = get_printqueue(snum,cnum,&queue,NULL);
-
+ int i, count;
+ lpq_reset(snum);
+
+ count = get_printqueue(snum,cnum,&queue,NULL);
for (i = 0; i < count; i++)
del_printqueue(cnum,snum,queue[i].job);
-
+
if (queue) free(queue);
}
@@ -1094,57 +1120,128 @@
/****************************************************************************
- set the name of a print job (undocumented?)
- ****************************************************************************/
-static BOOL api_PrintJobInfo(int cnum,int uid, char *param,char *data,
- int mdrcnt,int mprcnt,
- char **rdata,char **rparam,
- int *rdata_len,int *rparam_len)
+ set the property of a print job (undocumented?)
+ ? function = 0xb -> set name of print job
+ ? function = 0x6 -> move print job up/down
+ Form: <WWsTP> <WWzWWDDzzzzzzzzzzlz>
+ or <WWsTP> <WB21BB16B10zWWzDDz>
+****************************************************************************/
+static int check_printjob_info(struct pack_desc* desc,
+ int uLevel, const char* id)
+{
+ desc->subformat = NULL;
+ switch( uLevel ) {
+ case 0: desc->format = "W"; break;
+ case 1: desc->format = "WB21BB16B10zWWzDDz"; break;
+ case 2: desc->format = "WWzWWDDzz"; break;
+ case 3: desc->format = "WWzWWDDzzzzzzzzzzlz"; break;
+ default: return False;
+ }
+ if (strcmp(desc->format,id) != 0) return False;
+ return True;
+}
+
+static BOOL api_PrintJobInfo(int cnum,int uid,char *param,char *data,
+ int mdrcnt,int mprcnt,
+ char **rdata,char **rparam,
+ int *rdata_len,int *rparam_len)
{
- pstring name;
+ struct pack_desc desc;
+ char *str1 = param+2;
+ char *str2 = skip_string(str1,1);
+ char *p = skip_string(str2,1);
+ int jobid = (SVAL(p,0)&0xFF); /* the snum and jobid are encoded
+ by the print queue api */
+ int snum = (SVAL(p,0)>>8);
+ int uLevel = SVAL(p,2);
+ int function = SVAL(p,4); /* what is this ?? */
+ int i;
char *s = data;
+
*rparam_len = 4;
*rparam = REALLOC(*rparam,*rparam_len);
-
- lpq_cache_reset = True;
-
+
*rdata_len = 0;
-
- SSVAL(*rparam,0,NERR_Success);
- SSVAL(*rparam,2,0); /* converter word */
-
- /* now try to extract the name. As I don't really understand this
- API this is mostly guesswork.
- */
- if (isalpha(*s))
- {
- int i,l = 0;
- while (l<64 && *s)
- {
- if (isalnum(*s) || strchr("-._",*s))
- name[l++] = *s;
- s++;
- }
- name[l] = 0;
-
- DEBUG(3,("Setting print name to %s\n",name));
-
- for (i=0;i<MAX_OPEN_FILES;i++)
- if (Files[i].open && Files[i].print_file)
+
+ /* check it's a supported varient */
+ if ((strcmp(str1,"WWsTP")) || (!check_printjob_info(&desc,uLevel,str2)))
+ return(False);
+
+ switch (function) {
+ case 0x6: /* change job place in the queue, data gives the new place */
+ if (snum >= 0)
+ {
+ print_queue_struct *queue=NULL;
+ int count;
+
+ lpq_reset(snum);
+ count = get_printqueue(snum,cnum,&queue,NULL);
+ for (i=0;i<count;i++) /* find job */
+ if ((queue[i].job%0xFF) == jobid) break;
+
+ if (i==count) {
+ desc.errcode=NERR_JobNotFound;
+ if (queue) free(queue);
+ }
+ else {
+ desc.errcode=NERR_Success;
+ i++;
+#if 0
{
- pstring wd;
- GetWd(wd);
- unbecome_user();
-
- if (!become_user(Files[i].cnum,uid) || !become_service(Files[i].cnum,True))
- break;
-
- if (rename(Files[i].name,name) == 0)
- string_set(&Files[i].name,name);
- break;
+ int place= SVAL(data,0);
+ /* we currently have no way of doing this. Can any unix do it? */
+ if (i < place) /* move down */;
+ else if (i > place ) /* move up */;
}
- }
-
+#endif
+ desc.errcode=NERR_notsupported; /* not yet supported */
+ if (queue) free(queue);
+ }
+ }
+ else desc.errcode=NERR_JobNotFound;
+ break;
+ case 0xb: /* change print job name, data gives the name */
+ /* jobid, snum should be zero */
+ if (isalpha(*s))
+ {
+ pstring name;
+ int l = 0;
+ while (l<64 && *s)
+ {
+ if (isalnum(*s) || strchr("-._",*s))
+ name[l++] = *s;
+ s++;
+ }
+ name[l] = 0;
+
+ DEBUG(3,("Setting print name to %s\n",name));
+
+ for (i=0;i<MAX_OPEN_FILES;i++)
+ if (Files[i].open && Files[i].print_file)
+ {
+ pstring wd;
+ GetWd(wd);
+ unbecome_user();
+
+ if (!become_user(Files[i].cnum,uid) ||
+ !become_service(Files[i].cnum,True))
+ break;
+
+ if (rename(Files[i].name,name) == 0)
+ string_set(&Files[i].name,name);
+ break;
+ }
+ }
+ desc.errcode=NERR_Success;
+
+ break;
+ default: /* not implemented */
+ return False;
+ }
+
+ SSVALS(*rparam,0,desc.errcode);
+ SSVAL(*rparam,2,0); /* converter word */
+
return(True);
}
@@ -1472,24 +1569,24 @@
desc.format = str2;
if (init_package(&desc,1,0)) {
- PACK(&desc,"W",0); /* code */
- PACK(&desc,"B21",name); /* eff. name */
- PACK(&desc,"B",""); /* pad */
- PACK(&desc,"W",2); /* priv */
- PACK(&desc,"D",0); /* auth flags */
- PACK(&desc,"W",0); /* num logons */
- PACK(&desc,"W",0); /* bad pw count */
- PACK(&desc,"D",0); /* last logon */
- PACK(&desc,"D",0); /* last logoff */
- PACK(&desc,"D",-1); /* logoff time */
- PACK(&desc,"D",-1); /* kickoff time */
- PACK(&desc,"D",0); /* password age */
- PACK(&desc,"D",0); /* password can change */
- PACK(&desc,"D",-1); /* password must change */
- PACK(&desc,"z",local_machine);/* computer */
- PACK(&desc,"z",lp_workgroup());/* domain */
- PACK(&desc,"z",0); /* script path */
- PACK(&desc,"D",0); /* reserved */
+ PACKI(&desc,"W",0); /* code */
+ PACKS(&desc,"B21",name); /* eff. name */
+ PACKS(&desc,"B",""); /* pad */
+ PACKI(&desc,"W",2); /* priv */
+ PACKI(&desc,"D",0); /* auth flags */
+ PACKI(&desc,"W",0); /* num logons */
+ PACKI(&desc,"W",0); /* bad pw count */
+ PACKI(&desc,"D",0); /* last logon */
+ PACKI(&desc,"D",0); /* last logoff */
+ PACKI(&desc,"D",-1); /* logoff time */
+ PACKI(&desc,"D",-1); /* kickoff time */
+ PACKI(&desc,"D",0); /* password age */
+ PACKI(&desc,"D",0); /* password can change */
+ PACKI(&desc,"D",-1); /* password must change */
+ PACKS(&desc,"z",local_machine);/* computer */
+ PACKS(&desc,"z",lp_workgroup());/* domain */
+ PACKS(&desc,"z",""); /* script path */
+ PACKI(&desc,"D",0); /* reserved */
}
*rdata_len = desc.usedlen;
@@ -1535,22 +1632,6 @@
/****************************************************************************
api_WPrintJobEnumerate
****************************************************************************/
-
-static int check_printjob_info(struct pack_desc* desc,
- int uLevel, const char* id)
-{
- desc->subformat = NULL;
- switch( uLevel ) {
- case 0: desc->format = "W"; break;
- case 1: desc->format = "WB21BB16B10zWWzDDz"; break;
- case 2: desc->format = "WWzWWDDzz"; break;
- case 3: desc->format = "WWzWWDDzzzzzzzzzzlz"; break;
- default: return False;
- }
- if (strcmp(desc->format,id) != 0) return False;
- return True;
-}
-
static BOOL api_WPrintJobGetInfo(int cnum,int uid, char *param,char *data,
int mdrcnt,int mprcnt,
char **rdata,char **rparam,
@@ -1705,27 +1786,27 @@
strcpy(buf,SERVICE(snum));
strupper(buf);
if (uLevel <= 1) {
- PACK(desc,"B9",buf); /* szName */
+ PACKS(desc,"B9",buf); /* szName */
if (uLevel == 1) {
- PACK(desc,"B21",""); /* szUserName */
- PACK(desc,"W",0); /* uJobId */
- PACK(desc,"W",0); /* fsStatus */
- PACK(desc,"z",""); /* pszStatus */
- PACK(desc,"W",0); /* time */
+ PACKS(desc,"B21",""); /* szUserName */
+ PACKI(desc,"W",0); /* uJobId */
+ PACKI(desc,"W",0); /* fsStatus */
+ PACKS(desc,"z",""); /* pszStatus */
+ PACKI(desc,"W",0); /* time */
}
}
if (uLevel == 2 || uLevel == 3) {
- PACK(desc,"z",buf); /* pszPrinterName */
+ PACKS(desc,"z",buf); /* pszPrinterName */
if (uLevel == 3) {
- PACK(desc,"z",""); /* pszUserName */
- PACK(desc,"z",0); /* pszLogAddr */
- PACK(desc,"W",0); /* uJobId */
- PACK(desc,"W",0); /* fsStatus */
- PACK(desc,"z",""); /* pszStatus */
- PACK(desc,"z",""); /* pszComment */
- PACK(desc,"z","NULL"); /* pszDrivers */
- PACK(desc,"W",0); /* time */
- PACK(desc,"W",0); /* pad1 */
+ PACKS(desc,"z",""); /* pszUserName */
+ PACKS(desc,"z",""); /* pszLogAddr */
+ PACKI(desc,"W",0); /* uJobId */
+ PACKI(desc,"W",0); /* fsStatus */
+ PACKS(desc,"z",""); /* pszStatus */
+ PACKS(desc,"z",""); /* pszComment */
+ PACKS(desc,"z","NULL"); /* pszDrivers */
+ PACKI(desc,"W",0); /* time */
+ PACKI(desc,"W",0); /* pad1 */
}
}
}
@@ -1874,7 +1955,7 @@
desc.base = *rdata;
desc.buflen = mdrcnt;
if (init_package(&desc,1,0)) {
- PACK(&desc,"B41","NULL");
+ PACKS(&desc,"B41","NULL");
}
succnt = (desc.errcode == NERR_Success ? 1 : 0);
@@ -1920,7 +2001,7 @@
desc.buflen = mdrcnt;
desc.format = str2;
if (init_package(&desc,1,0)) {
- PACK(&desc,"B13","lpd");
+ PACKS(&desc,"B13","lpd");
}
succnt = (desc.errcode == NERR_Success ? 1 : 0);
@@ -1967,7 +2048,7 @@
desc.buflen = mdrcnt;
desc.format = str2;
if (init_package(&desc,1,0)) {
- PACK(&desc,"B13","lp0");
+ PACKS(&desc,"B13","lp0");
}
succnt = (desc.errcode == NERR_Success ? 1 : 0);
@@ -2047,6 +2128,8 @@
{"WPrintJobEnumerate",76, api_WPrintJobEnumerate,0},
{"WPrintJobGetInfo", 77, api_WPrintJobGetInfo,0},
{"RDosPrintJobDel", 81, api_RDosPrintJobDel,0},
+ {"RDosPrintJobPause", 82, api_RDosPrintJobDel,0},
+ {"RDosPrintJobResume",83, api_RDosPrintJobDel,0},
{"WPrintDestEnum", 84, api_WPrintDestEnum,0},
{"WPrintDestGetInfo", 85, api_WPrintDestGetInfo,0},
{"NetRemoteTOD", 91, api_NetRemoteTOD,0},
diff -u -r --new-file last-version/source/kanji.c samba-1.9.14alpha17/source/kanji.c
--- last-version/source/kanji.c Thu Jun 29 18:18:23 1995
+++ samba-1.9.14alpha17/source/kanji.c Fri Sep 15 20:17:44 1995
@@ -20,22 +20,69 @@
Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5
and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
- Adding for Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
+ and add all jis codes sequence type at 1995.8.16
+ Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
*/
#ifdef KANJI
#define _KANJI_C_
#include "includes.h"
-#include "kanji.h"
-
/* coding system keep in */
int coding_system = SJIS_CODE;
-/*
+/* jis si/so sequence */
+char jis_kso = JIS_KSO;
+char jis_ksi = JIS_KSI;
+char hex_tag = HEXTAG;
+
+/*******************************************************************
+ SHIFT JIS functions
+********************************************************************/
+/*******************************************************************
+ search token from S1 separated any char of S2
+ S1 contain SHIFT JIS chars.
+********************************************************************/
+char *
+sj_strtok (char *s1, const char *s2)
+{
+ static char *s = NULL;
+ char *q;
+ if (!s1) {
+ if (!s) {
+ return NULL;
+ }
+ s1 = s;
+ }
+ for (q = s1; *s1; ) {
+ if (is_shift_jis (*s1)) {
+ s1 += 2;
+ } else if (is_kana (*s1)) {
+ s1++;
+ } else {
+ char *p = strchr (s2, *s1);
+ if (p) {
+ if (s1 != q) {
+ s = s1 + 1;
+ *s1 = '\0';
+ return q;
+ }
+ q = s1 + 1;
+ }
+ s1++;
+ }
+ }
+ s = NULL;
+ if (*q) {
+ return q;
+ }
+ return NULL;
+}
+
+/*******************************************************************
search string S2 from S1
S1 contain SHIFT JIS chars.
-*/
+********************************************************************/
char *
sj_strstr (const char *s1, const char *s2)
{
@@ -56,10 +103,10 @@
return 0;
}
-/*
+/*******************************************************************
Search char C from beginning of S.
S contain SHIFT JIS chars.
-*/
+********************************************************************/
char *
sj_strchr (const char *s, int c)
{
@@ -75,10 +122,10 @@
return 0;
}
-/*
+/*******************************************************************
Search char C end of S.
S contain SHIFT JIS chars.
-*/
+********************************************************************/
char *
sj_strrchr (const char *s, int c)
{
@@ -97,9 +144,15 @@
return q;
}
+/*******************************************************************
+ Code conversion
+********************************************************************/
/* convesion buffer */
static char cvtbuf[1024];
+/*******************************************************************
+ EUC <-> SJIS
+********************************************************************/
static int
euc2sjis (register int hi, register int lo)
{
@@ -120,10 +173,10 @@
(lo + (lo >= 0x7f ? 0x60 : 0x61));
}
-/*
+/*******************************************************************
Convert FROM contain SHIFT JIS codes to EUC codes
return converted buffer
- */
+********************************************************************/
static char *
sj_to_euc (const char *from, BOOL overwrite)
{
@@ -153,10 +206,10 @@
}
}
-/*
+/*******************************************************************
Convert FROM contain EUC codes to SHIFT JIS codes
return converted buffer
-*/
+********************************************************************/
static char *
euc_to_sj (const char *from, BOOL overwrite)
{
@@ -186,6 +239,9 @@
}
}
+/*******************************************************************
+ JIS7,JIS8,JUNET <-> SJIS
+********************************************************************/
static int
sjis2jis (register int hi, register int lo)
{
@@ -206,10 +262,10 @@
return ((hi / 2 + (hi < 0x5f ? 0x70 : 0xb0)) << 8) | (lo + 0x7e);
}
-/*
+/*******************************************************************
Convert FROM contain JIS codes to SHIFT JIS codes
return converted buffer
- */
+********************************************************************/
static char *
jis8_to_sj (const char *from, BOOL overwrite)
{
@@ -257,10 +313,10 @@
}
}
-/*
+/*******************************************************************
Convert FROM contain SHIFT JIS codes to JIS codes
return converted buffer
-*/
+********************************************************************/
static char *
sj_to_jis8 (const char *from, BOOL overwrite)
{
@@ -277,7 +333,7 @@
case _KJ_ROMAN: /* to KANJI */
*out++ = jis_esc;
*out++ = jis_so1;
- *out++ = JIS_KSO;
+ *out++ = jis_kso;
shifted = _KJ_KANJI;
break;
}
@@ -290,7 +346,7 @@
case _KJ_KANJI: /* to ROMAN/KANA */
*out++ = jis_esc;
*out++ = jis_si1;
- *out++ = JIS_KSI;
+ *out++ = jis_ksi;
shifted = _KJ_ROMAN;
break;
}
@@ -301,7 +357,7 @@
case _KJ_KANJI: /* to ROMAN/KANA */
*out++ = jis_esc;
*out++ = jis_si1;
- *out++ = JIS_KSI;
+ *out++ = jis_ksi;
shifted = _KJ_ROMAN;
break;
}
@@ -314,10 +370,10 @@
}
}
-/*
+/*******************************************************************
Convert FROM contain 7 bits JIS codes to SHIFT JIS codes
return converted buffer
- */
+********************************************************************/
static char *
jis7_to_sj (const char *from, BOOL overwrite)
{
@@ -374,10 +430,10 @@
}
}
-/*
+/*******************************************************************
Convert FROM contain SHIFT JIS codes to 7 bits JIS codes
return converted buffer
-*/
+********************************************************************/
static char *
sj_to_jis7 (const char *from, BOOL overwrite)
{
@@ -396,7 +452,7 @@
case _KJ_ROMAN: /* to KANJI */
*out++ = jis_esc;
*out++ = jis_so1;
- *out++ = JIS_KSO;
+ *out++ = jis_kso;
shifted = _KJ_KANJI;
break;
}
@@ -409,7 +465,7 @@
case _KJ_KANJI: /* to ROMAN */
*out++ = jis_esc;
*out++ = jis_si1;
- *out++ = JIS_KSI;
+ *out++ = jis_ksi;
case _KJ_ROMAN: /* to KANA */
*out++ = jis_so;
shifted = _KJ_KANA;
@@ -425,7 +481,7 @@
case _KJ_KANJI: /* to ROMAN */
*out++ = jis_esc;
*out++ = jis_si1;
- *out++ = JIS_KSI;
+ *out++ = jis_ksi;
shifted = _KJ_ROMAN;
break;
}
@@ -439,7 +495,7 @@
case _KJ_KANJI: /* to ROMAN */
*out++ = jis_esc;
*out++ = jis_si1;
- *out++ = JIS_KSI;
+ *out++ = jis_ksi;
break;
}
*out = 0;
@@ -451,10 +507,10 @@
}
}
-/*
+/*******************************************************************
Convert FROM contain 7 bits JIS(junet) codes to SHIFT JIS codes
return converted buffer
- */
+********************************************************************/
static char *
junet_to_sj (const char *from, BOOL overwrite)
{
@@ -474,7 +530,7 @@
from += 3;
} else if (is_juk1(from[1]) && is_juk2 (from[2])) {
shifted = _KJ_KANA;
- break;
+ from += 3;
} else { /* sequence error */
goto normal;
}
@@ -508,10 +564,10 @@
}
}
-/*
+/*******************************************************************
Convert FROM contain SHIFT JIS codes to 7 bits JIS(junet) codes
return converted buffer
-*/
+********************************************************************/
static char *
sj_to_junet (const char *from, BOOL overwrite)
{
@@ -578,43 +634,38 @@
}
}
-#define HEXTAG ':'
-
-#define hex2bin(x) \
- ( ((int) '0' <= ((int) (x)) && ((int) (x)) <= (int)'9')? \
- (((int) (x))-(int)'0'): \
- ((int) 'a'<= ((int) (x)) && ((int) (x))<= (int) 'f')? \
- (((int) (x)) - (int)'a'+10): \
- (((int) (x)) - (int)'A'+10) )
-#define bin2hex(x) \
- ( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') )
-
+/*******************************************************************
+ HEX <-> SJIS
+********************************************************************/
/* ":xx" -> a byte */
static char *
-hex_to_sj(char *from, BOOL overwrite)
+hex_to_sj (const char *from, BOOL overwrite)
{
char *sp, *dp;
- sp = from; dp = cvtbuf;
+ sp = (char *) from;
+ dp = cvtbuf;
while (*sp) {
- if (*sp == HEXTAG && isxdigit(sp[1]) && isxdigit(sp[2])) {
- *dp++ = (hex2bin(sp[1])<<4) | (hex2bin(sp[2]));
+ if (*sp == hex_tag && isxdigit (sp[1]) && isxdigit (sp[2])) {
+ *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2]));
sp += 3;
} else
*dp++ = *sp++;
}
*dp = '\0';
if (overwrite) {
- strcpy((char *) from, (const char *) cvtbuf);
+ strcpy ((char *) from, (const char *) cvtbuf);
return (char *) from;
} else {
return cvtbuf;
}
}
-/* kanji/kana -> ":xx" */
+/*******************************************************************
+ kanji/kana -> ":xx"
+********************************************************************/
static char *
-sj_to_hex(char *from, BOOL overwrite)
+sj_to_hex (const char *from, BOOL overwrite)
{
unsigned char *sp, *dp;
@@ -622,99 +673,90 @@
dp = (unsigned char*) cvtbuf;
while (*sp) {
if (is_kana(*sp)) {
- *dp++ = HEXTAG;
- *dp++ = bin2hex(((*sp)>>4)&0x0f);
- *dp++ = bin2hex((*sp)&0x0f);
+ *dp++ = hex_tag;
+ *dp++ = bin2hex (((*sp)>>4)&0x0f);
+ *dp++ = bin2hex ((*sp)&0x0f);
sp++;
- } else if (is_shift_jis(*sp) && is_shift_jis2(sp[1])) {
- *dp++ = HEXTAG;
- *dp++ = bin2hex(((*sp)>>4)&0x0f);
- *dp++ = bin2hex((*sp)&0x0f);
+ } else if (is_shift_jis (*sp) && is_shift_jis2 (sp[1])) {
+ *dp++ = hex_tag;
+ *dp++ = bin2hex (((*sp)>>4)&0x0f);
+ *dp++ = bin2hex ((*sp)&0x0f);
sp++;
- *dp++ = HEXTAG;
- *dp++ = bin2hex(((*sp)>>4)&0x0f);
- *dp++ = bin2hex((*sp)&0x0f);
+ *dp++ = hex_tag;
+ *dp++ = bin2hex (((*sp)>>4)&0x0f);
+ *dp++ = bin2hex ((*sp)&0x0f);
sp++;
} else
*dp++ = *sp++;
}
*dp = '\0';
if (overwrite) {
- strcpy((char *) from, (const char *) cvtbuf);
+ strcpy ((char *) from, (const char *) cvtbuf);
return (char *) from;
} else {
return cvtbuf;
}
}
-/*
- * Convert coding_system CODE to dos CODE(sjis)
- */
-char *
-kj_dos_format (char *str, BOOL overwrite)
+/*******************************************************************
+ sj to sj
+********************************************************************/
+static char *
+sj_to_sj (const char *from, BOOL overwrite)
{
- static char* (*func)() = 0;
- static int func_inited = 0;
-
- if (!func_inited) {
- switch (coding_system) {
- case EUC_CODE:
- func = euc_to_sj;
- break;
- case JIS7_CODE:
- func = jis7_to_sj;
- break;
- case JIS8_CODE:
- func = jis8_to_sj;
- break;
- case JUNET_CODE:
- func = junet_to_sj;
- break;
- case HEX_CODE:
- func = hex_to_sj;
- break;
- default:
- case SJIS_CODE:
- break; /* nothing to convert */
- }
- func_inited = 1;
+ if (!overwrite) {
+ strcpy (cvtbuf, (const char *) from);
+ return cvtbuf;
+ } else {
+ return (char *) from;
}
- return (func ? (*func) (str, overwrite) : str);
}
-/*
- * Convert dos CODE(sjis) to coding_system CODE
- */
-char *
-kj_unix_format (char *str, BOOL overwrite)
+/************************************************************************
+ conversion:
+ _dos_to_unix _unix_to_dos
+************************************************************************/
+
+char* (*_dos_to_unix) (const char *str, BOOL overwrite) = sj_to_sj;
+char* (*_unix_to_dos) (const char *str, BOOL overwrite) = sj_to_sj;
+
+static int
+setup_string_function (int codes)
{
- static char* (*func)() = 0;
- static int func_inited = 0;
+ switch (codes) {
+ default:
+ case SJIS_CODE:
+ _dos_to_unix = sj_to_sj;
+ _unix_to_dos = sj_to_sj;
- if (!func_inited) {
- switch (coding_system) {
- case EUC_CODE:
- func = sj_to_euc;
- break;
- case JIS7_CODE:
- func = sj_to_jis7;
- break;
- case JIS8_CODE:
- func = sj_to_jis8;
- break;
- case JUNET_CODE:
- func = sj_to_junet;
- break;
- case HEX_CODE:
- func = sj_to_hex;
- break;
- default:
- case SJIS_CODE:
- break; /* nothing to convert */
- }
- func_inited = 1;
+ break;
+
+ case EUC_CODE:
+ _dos_to_unix = sj_to_euc;
+ _unix_to_dos = euc_to_sj;
+ break;
+
+ case JIS7_CODE:
+ _dos_to_unix = sj_to_jis7;
+ _unix_to_dos = jis7_to_sj;
+ break;
+
+ case JIS8_CODE:
+ _dos_to_unix = sj_to_jis8;
+ _unix_to_dos = jis8_to_sj;
+ break;
+
+ case JUNET_CODE:
+ _dos_to_unix = sj_to_junet;
+ _unix_to_dos = junet_to_sj;
+ break;
+
+ case HEX_CODE:
+ _dos_to_unix = sj_to_hex;
+ _unix_to_dos = hex_to_sj;
+ break;
}
- return (func ? (*func) (str, overwrite) : str);
+ return codes;
}
/*
@@ -723,20 +765,92 @@
int
interpret_coding_system (char *str, int def)
{
+ int codes = def;
+
if (strequal (str, "sjis")) {
- return SJIS_CODE;
+ codes = SJIS_CODE;
} else if (strequal (str, "euc")) {
- return EUC_CODE;
- } else if (strequal (str, "jis8")) {
- return JIS8_CODE;
- } else if (strequal (str, "jis7")) {
- return JIS7_CODE;
- } else if (strequal (str, "junet")) {
- return JUNET_CODE;
+ codes = EUC_CODE;
} else if (strequal (str, "hex")) {
- return HEX_CODE;
- }
- return def;
+ codes = HEX_CODE;
+ hex_tag = HEXTAG;
+ } else if (strncasecmp (str, "hex", 3)) {
+ codes = HEX_CODE;
+ hex_tag = (str[3] ? str[3] : HEXTAG);
+ } else if (strequal (str, "j8bb")) {
+ codes = JIS8_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'B';
+ } else if (strequal (str, "j8bj") || strequal (str, "jis8")) {
+ codes = JIS8_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'J';
+ } else if (strequal (str, "j8bh")) {
+ codes = JIS8_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'H';
+ } else if (strequal (str, "j8@b")) {
+ codes = JIS8_CODE;
+ jis_kso = '@';
+ jis_ksi = 'B';
+ } else if (strequal (str, "j8@j")) {
+ codes = JIS8_CODE;
+ jis_kso = '@';
+ jis_ksi = 'J';
+ } else if (strequal (str, "j8@h")) {
+ codes = JIS8_CODE;
+ jis_kso = '@';
+ jis_ksi = 'H';
+ } else if (strequal (str, "j7bb")) {
+ codes = JIS7_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'B';
+ } else if (strequal (str, "j7bj") || strequal (str, "jis7")) {
+ codes = JIS7_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'J';
+ } else if (strequal (str, "j7bh")) {
+ codes = JIS7_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'H';
+ } else if (strequal (str, "j7@b")) {
+ codes = JIS7_CODE;
+ jis_kso = '@';
+ jis_ksi = 'B';
+ } else if (strequal (str, "j7@j")) {
+ codes = JIS7_CODE;
+ jis_kso = '@';
+ jis_ksi = 'J';
+ } else if (strequal (str, "j7@h")) {
+ codes = JIS7_CODE;
+ jis_kso = '@';
+ jis_ksi = 'H';
+ } else if (strequal (str, "jubb")) {
+ codes = JUNET_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'B';
+ } else if (strequal (str, "jubj") || strequal (str, "junet")) {
+ codes = JUNET_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'J';
+ } else if (strequal (str, "jubh")) {
+ codes = JUNET_CODE;
+ jis_kso = 'B';
+ jis_ksi = 'H';
+ } else if (strequal (str, "ju@b")) {
+ codes = JUNET_CODE;
+ jis_kso = '@';
+ jis_ksi = 'B';
+ } else if (strequal (str, "ju@j")) {
+ codes = JUNET_CODE;
+ jis_kso = '@';
+ jis_ksi = 'J';
+ } else if (strequal (str, "ju@h")) {
+ codes = JUNET_CODE;
+ jis_kso = '@';
+ jis_ksi = 'H';
+ }
+ return setup_string_function (codes);
}
#else
int kanji_dummy_procedure(void)
diff -u -r --new-file last-version/source/kanji.h samba-1.9.14alpha17/source/kanji.h
--- last-version/source/kanji.h Thu Jun 29 18:18:28 1995
+++ samba-1.9.14alpha17/source/kanji.h Fri Sep 15 20:17:44 1995
@@ -20,11 +20,17 @@
Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5
and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11
- Adding for Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
+ and add all jis codes sequence at 1995.8.16
+ Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp>
*/
#ifndef _KANJI_H_
#define _KANJI_H_
+#ifdef KANJI
+#ifndef REPLACE_RENAME
+#define REPLACE_RENAME
+#endif
+
/* FOR SHIFT JIS CODE */
#define is_shift_jis(c) \
((0x80 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0x9f) \
@@ -74,10 +80,35 @@
#define _KJ_KANJI (1)
#define _KJ_KANA (2)
+/* FOR HEX */
+#define HEXTAG ':'
+#define hex2bin(x) \
+ ( ((int) '0' <= ((int) (x)) && ((int) (x)) <= (int)'9')? \
+ (((int) (x))-(int)'0'): \
+ ((int) 'a'<= ((int) (x)) && ((int) (x))<= (int) 'f')? \
+ (((int) (x)) - (int)'a'+10): \
+ (((int) (x)) - (int)'A'+10) )
+#define bin2hex(x) \
+ ( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') )
+
#else /* not _KANJI_C_ */
+
+extern char* (*_dos_to_unix) (const char *str, BOOL overwrite);
+extern char* (*_unix_to_dos) (const char *str, BOOL overwrite);
+
+#define unix_to_dos (*_unix_to_dos)
+#define dos_to_unix (*_dos_to_unix)
+
+extern char *sj_strtok (char *s1, const char *s2);
+extern char *sj_strchr (const char *s, int c);
+extern char *sj_strrchr (const char *s, int c);
+extern char *sj_strstr (const char *s1, const char *s2);
+
#define strchr sj_strchr
#define strrchr sj_strrchr
#define strstr sj_strstr
+#define strtok sj_strtok
+
#endif /* _KANJI_C_ */
#define UNKNOWN_CODE (-1)
@@ -89,12 +120,13 @@
#define HEX_CODE (5)
#define DOSV_CODE SJIS_CODE
-char *sj_strstr (const char *s1, const char *s2);
-char *sj_strchr (const char *s, int c);
-char *sj_strrchr (const char *s, int c);
-
int interpret_coding_system (char *str, int def);
-char *kj_dos_format (char *str, BOOL overwrite);
-char *kj_unix_format (char *str, BOOL overwrite);
+
+#else
+
+#define unix_to_dos(x,y) (x)
+#define dos_to_unix(x,y) (x)
+
+#endif /* not KANJI */
#endif /* _KANJI_H_ */
diff -u -r --new-file last-version/source/loadparm.c samba-1.9.14alpha17/source/loadparm.c
--- last-version/source/loadparm.c Sat Sep 2 13:35:39 1995
+++ samba-1.9.14alpha17/source/loadparm.c Fri Sep 15 17:58:05 1995
@@ -179,6 +179,8 @@
char *szPrintcommand;
char *szLpqcommand;
char *szLprmcommand;
+ char *szLppausecommand;
+ char *szLpresumecommand;
char *szPrintername;
char *szDontdescend;
char *szHostsallow;
@@ -246,6 +248,8 @@
NULL, /* szPrintcommand */
NULL, /* szLpqcommand */
NULL, /* szLprmcommand */
+ NULL, /* szLppausecommand */
+ NULL, /* szLpresumecommand */
NULL, /* szPrintername */
NULL, /* szDontdescend */
NULL, /* szHostsallow */
@@ -449,6 +453,8 @@
{"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL},
{"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL},
{"lprm command", P_STRING, P_LOCAL, &sDefault.szLprmcommand, NULL},
+ {"lppause command", P_STRING, P_LOCAL, &sDefault.szLppausecommand, NULL},
+ {"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand,NULL},
{"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL},
{"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL},
{"hosts allow", P_STRING, P_LOCAL, &sDefault.szHostsallow, NULL},
@@ -666,6 +672,8 @@
FN_LOCAL_STRING(lp_printcommand,szPrintcommand)
FN_LOCAL_STRING(lp_lpqcommand,szLpqcommand)
FN_LOCAL_STRING(lp_lprmcommand,szLprmcommand)
+FN_LOCAL_STRING(lp_lppausecommand,szLppausecommand)
+FN_LOCAL_STRING(lp_lpresumecommand,szLpresumecommand)
FN_LOCAL_STRING(lp_printername,szPrintername)
FN_LOCAL_STRING(lp_hostsallow,szHostsallow)
FN_LOCAL_STRING(lp_hostsdeny,szHostsdeny)
diff -u -r --new-file last-version/source/loadparm.h samba-1.9.14alpha17/source/loadparm.h
--- last-version/source/loadparm.h Tue Jul 11 15:49:06 1995
+++ samba-1.9.14alpha17/source/loadparm.h Fri Sep 15 17:58:30 1995
@@ -94,6 +94,8 @@
extern char *lp_printcommand(int iService);
extern char *lp_lpqcommand(int iService);
extern char *lp_lprmcommand(int iService);
+extern char *lp_lppausecommand(int iService);
+extern char *lp_lpresumecommand(int iService);
extern char *lp_printername(int iService);
extern char *lp_hostsallow(int iService);
extern char *lp_hostsdeny(int iService);
diff -u -r --new-file last-version/source/local.h samba-1.9.14alpha17/source/local.h
--- last-version/source/local.h Tue Sep 12 19:50:43 1995
+++ samba-1.9.14alpha17/source/local.h Thu Sep 14 10:32:52 1995
@@ -73,6 +73,8 @@
NOTE: This also slows down the server considerably */
#define REDUCE_PATHS
+/* the size of the directory cache */
+#define DIRCACHESIZE 20
/* what type of filesystem do we want this to show up as in a NT file
manager window? */
diff -u -r --new-file last-version/source/mangle.c samba-1.9.14alpha17/source/mangle.c
--- last-version/source/mangle.c Tue Sep 12 22:04:26 1995
+++ samba-1.9.14alpha17/source/mangle.c Fri Sep 15 20:34:00 1995
@@ -536,11 +536,7 @@
BOOL name_convert(char *OutName,char *InName,BOOL need83,int snum)
{
/* initially just copy it */
-#ifdef KANJI
- strcpy(OutName, kj_dos_format (InName, False));
-#else
strcpy(OutName,unix2dos_format(InName,False));
-#endif
/* apply any name mappings */
{
diff -u -r --new-file last-version/source/password.c samba-1.9.14alpha17/source/password.c
--- last-version/source/password.c Sun Sep 10 23:10:06 1995
+++ samba-1.9.14alpha17/source/password.c Thu Sep 14 13:05:11 1995
@@ -59,14 +59,13 @@
{
if (!challenge_sent) return(False);
memcpy(challenge,saved_challenge,8);
-/* challenge_sent = False; */
return(True);
}
#endif
/* this holds info on user ids that are already validated for this VC */
-user_struct *validated_users = NULL;
-int num_validated_users = 0;
+static user_struct *validated_users = NULL;
+static int num_validated_users = 0;
/****************************************************************************
check if a uid has been validated, and return an index if it has. -1 if not
@@ -79,7 +78,8 @@
for (i=0;i<num_validated_users;i++)
if (validated_users[i].uid == uid)
{
- DEBUG(3,("valid uid %d mapped to vuid %d\n",uid,i));
+ DEBUG(3,("valid uid %d mapped to vuid %d (user=%s)\n",
+ uid,i,validated_users[i].name));
return(i);
}
return(-1);
@@ -89,7 +89,6 @@
check if a uid has been validated, and return an pointer to the user_struct
if it has. NULL if not
****************************************************************************/
-
user_struct *get_valid_user_struct(int uid)
{
int vuid = valid_uid(uid);
@@ -107,19 +106,17 @@
for (i=0;i<num_validated_users;i++)
if (validated_users[i].uid == uid)
{
- user_struct *vuser = &validated_users[i];
- vuser->uid = -1;
- vuser->gid = -1;
- vuser->user_ngroups = 0;
- if(vuser->user_groups && (vuser->user_groups != (gid_t *)vuser->user_igroups))
- free(vuser->user_groups);
- vuser->user_groups = NULL;
- if(vuser->user_igroups)
- free(vuser->user_igroups);
- vuser->user_igroups = NULL;
+ user_struct *vuser = &validated_users[i];
+ vuser->uid = -1;
+ vuser->gid = -1;
+ vuser->user_ngroups = 0;
+ if(vuser->user_groups && (vuser->user_groups != (gid_t *)vuser->user_igroups))
+ free(vuser->user_groups);
+ vuser->user_groups = NULL;
+ if(vuser->user_igroups)
+ free(vuser->user_igroups);
+ vuser->user_igroups = NULL;
}
-
- return;
}
diff -u -r --new-file last-version/source/printing.c samba-1.9.14alpha17/source/printing.c
--- last-version/source/printing.c Thu Jul 6 17:48:00 1995
+++ samba-1.9.14alpha17/source/printing.c Fri Sep 15 20:51:06 1995
@@ -25,9 +25,30 @@
extern connection_struct Connections[];
extern files_struct Files[];
-BOOL lpq_cache_reset = False;
+/*BOOL lpq_cache_reset = False;*/
+static BOOL * lpq_cache_reset=NULL;
+static int check_lpq_cache(int snum) {
+ static int lpq_caches=0;
+
+ if (lpq_caches <= snum) {
+ BOOL * p;
+ p = (BOOL *) realloc(lpq_cache_reset,(snum+1)*sizeof(BOOL));
+ if (p) {
+ lpq_cache_reset=p;
+ lpq_caches = snum+1;
+ }
+ }
+ return lpq_caches;
+}
+
+void lpq_reset(int snum)
+{
+ if (check_lpq_cache(snum) > snum) lpq_cache_reset[snum]=True;
+}
+
+
/****************************************************************************
Build the print command in the supplied buffer. This means getting the
print command for the service and inserting the printer name and the
@@ -99,19 +120,18 @@
{
pstring syscmd;
int cnum = Files[fnum].cnum;
+ int snum=SNUM(cnum);
char *tempstr;
- lpq_cache_reset = True;
-
*syscmd = 0;
if (file_size(Files[fnum].name) <= 0) {
DEBUG(3,("Discarding null print job %s\n",Files[fnum].name));
- unlink(Files[fnum].name);
+ sys_unlink(Files[fnum].name);
return;
}
- tempstr = build_print_command(cnum, PRINTCOMMAND(SNUM(cnum)), syscmd, Files[fnum].name);
+ tempstr = build_print_command(cnum, PRINTCOMMAND(snum), syscmd, Files[fnum].name);
if (tempstr != NULL)
{
int ret = smbrun(syscmd,NULL);
@@ -119,6 +139,8 @@
}
else
DEBUG(0,("Null print command?\n"));
+
+ lpq_reset(snum);
}
@@ -216,6 +238,7 @@
buf->job = atoi(tok[2]);
buf->size = atoi(tok[4]);
buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED;
+ buf->priority = 0;
buf->time = time(NULL);
StrnCpy(buf->user,tok[1],sizeof(buf->user)-1);
StrnCpy(buf->file,tok[3],sizeof(buf->file)-1);
@@ -274,6 +297,7 @@
buf->job = atoi(tok[1]);
buf->status = LPQ_QUEUED;
+ buf->priority = 0;
buf->time = time(NULL);
StrnCpy(buf->user,tok[3],sizeof(buf->user)-1);
StrnCpy(buf->file,tok[2],sizeof(buf->file)-1);
@@ -307,6 +331,7 @@
buf->job = atoi(tok[3]);
buf->status = strequal(tok[2],"RUNNING")?LPQ_PRINTING:LPQ_QUEUED;
+ buf->priority = 0;
buf->time = time(NULL);
StrnCpy(buf->user,tok[5],sizeof(buf->user)-1);
StrnCpy(buf->file,tok[4],sizeof(buf->file)-1);
@@ -320,29 +345,38 @@
/****************************************************************************
parse a lpq line
here is an example of lpq output under hpux; note there's no space after -o !
-navier> lpstat -oljplus
-ljplus-2153 user priority 0 Jan 19 08:14
+$> lpstat -oljplus
+ljplus-2153 user priority 0 Jan 19 08:14 on ljplus
util.c 125697 bytes
server.c 110712 bytes
-ljplus-2154 user priority 0 Jan 19 08:14
+ljplus-2154 user priority 0 Jan 19 08:14 from client
(standard input) 7551 bytes
****************************************************************************/
static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
{
/* must read two lines to process, therefore keep some values static */
- static BOOL header_line_ok=False;
+ static BOOL header_line_ok=False, base_prio_reset=False;
static string jobuser;
static int jobid;
+ static int jobprio;
static time_t jobtime;
static int jobstat=LPSTAT_OK;
+ /* to store minimum priority to print, lpstat command should be invoked
+ with -p option first, to work */
+ static int base_prio;
int count;
char TAB = '\011';
- string tok[8];
+ string tok[12];
/* If a line begins with a horizontal TAB, it is a subline type */
if (line[0] == TAB) { /* subline */
+ /* check if it contains the base priority */
+ if (!strncmp(line,"\tfence priority : ",18)) {
+ base_prio=atoi(&line[18]);
+ DEBUG(4, ("fence priority set at %d\n", base_prio));
+ }
if (!header_line_ok) return (False); /* incorrect header line */
/* handle the case of "(standard input)" as a filename */
string_sub(line,"standard input","STDIN");
@@ -367,30 +401,48 @@
buf->time = jobtime;
buf->job = jobid;
buf->status = jobstat;
+ buf->priority = jobprio;
StrnCpy(buf->user,jobuser,sizeof(buf->user)-1);
return(True);
}
else { /* header line */
- jobstat = ((first)&&(strstr(line,"on"))? LPQ_PRINTING:LPQ_QUEUED);
header_line_ok=False; /* reset it */
+ if (first) {
+ if (!base_prio_reset) {
+ base_prio=0; /* reset it */
+ base_prio_reset=True;
+ }
+ }
+ else if (base_prio) base_prio_reset=False;
+
/* handle the dash in the job id */
string_sub(line,"-"," ");
- for (count=0; count<8 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<12 && next_token(&line,tok[count],NULL); count++) ;
- /* we must get 8 tokens for time calculation, otherwise 3 will do */
- if (count < 3) return(False);
+ /* we must get 8 tokens */
+ if (count < 8) return(False);
/* first token must be printer name (cannot check ??) */
- /* the 2nd column must be integer */
- if (!isdigit(*tok[1])) return(False);
-
- /* process time */
- jobtime=EntryTime(tok, 5, count, 8);
-
+ /* the 2nd, 5th & 7th column must be integer */
+ if (!isdigit(*tok[1]) || !isdigit(*tok[4]) || !isdigit(*tok[6])) return(False);
jobid = atoi(tok[1]);
StrnCpy(jobuser,tok[2],sizeof(buf->user)-1);
+ jobprio = atoi(tok[4]);
+
+ /* process time */
+ jobtime=EntryTime(tok, 5, count, 8);
+ if (jobprio < base_prio) {
+ jobstat = LPQ_PAUSED;
+ DEBUG (4, ("job %d is paused: prio %d < %d; jobstat=%d\n", jobid, jobprio, base_prio, jobstat));
+ }
+ else {
+ jobstat = LPQ_QUEUED;
+ if ((strequal(tok[8],"on")) ||
+ ((strequal(tok[8],"from")) && (strequal(tok[10],"on"))))
+ jobstat = LPQ_PRINTING;
+ }
header_line_ok=True; /* information is correct */
return(False); /* need subline info to include into queuelist */
@@ -437,6 +489,7 @@
buf->job = atoi(tok[1]);
buf->size = atoi(tok[3]);
buf->status = strequal(tok[7],"on")?LPQ_PRINTING:LPQ_QUEUED;
+ buf->priority = 0;
buf->time = EntryTime(tok, 4, count, 7);
StrnCpy(buf->user,tok[2],sizeof(buf->user)-1);
StrnCpy(buf->file,tok[2],sizeof(buf->file)-1);
@@ -486,28 +539,32 @@
if (status && !ret)
{
/* a few simple checks to see if the line might be a
- printer status line */
+ printer status line:
+ handle them so that most severe condition is shown */
int i;
strlower(line);
-
- for (i=0; stat0_strings[i]; i++)
- if (strstr(line,stat0_strings[i])) {
- StrnCpy(status->message,line,sizeof(status->message)-1);
- status->status=LPSTAT_OK;
- return(ret);
- }
- for (i=0; stat1_strings[i]; i++)
- if (strstr(line,stat1_strings[i])) {
- StrnCpy(status->message,line,sizeof(status->message)-1);
- status->status=LPSTAT_STOPPED;
- return(ret);
- }
- for (i=0; stat2_strings[i]; i++)
- if (strstr(line,stat2_strings[i])) {
- StrnCpy(status->message,line,sizeof(status->message)-1);
- status->status=LPSTAT_ERROR;
- return(ret);
- }
+
+ switch (status->status) {
+ case LPSTAT_OK:
+ for (i=0; stat0_strings[i]; i++)
+ if (strstr(line,stat0_strings[i])) {
+ StrnCpy(status->message,line,sizeof(status->message)-1);
+ status->status=LPSTAT_OK;
+ }
+ case LPSTAT_STOPPED:
+ for (i=0; stat1_strings[i]; i++)
+ if (strstr(line,stat1_strings[i])) {
+ StrnCpy(status->message,line,sizeof(status->message)-1);
+ status->status=LPSTAT_STOPPED;
+ }
+ case LPSTAT_ERROR:
+ for (i=0; stat2_strings[i]; i++)
+ if (strstr(line,stat2_strings[i])) {
+ StrnCpy(status->message,line,sizeof(status->message)-1);
+ status->status=LPSTAT_ERROR;
+ }
+ break;
+ }
}
return(ret);
@@ -532,7 +589,8 @@
int lfd = -1;
*line = 0;
-
+ check_lpq_cache(snum);
+
if (!printername || !*printername)
{
DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n",
@@ -553,7 +611,7 @@
sprintf(outfile,"/tmp/lpq.%08x",str_checksum(syscmd));
- if (!lpq_cache_reset && cachetime && !stat(outfile,&sbuf))
+ if (!lpq_cache_reset[snum] && cachetime && !stat(outfile,&sbuf))
{
if (time(NULL) - sbuf.st_mtime < cachetime) {
DEBUG(3,("Using cached lpq output\n"));
@@ -576,7 +634,7 @@
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
}
- lpq_cache_reset = False;
+ lpq_cache_reset[snum] = False;
f = fopen(outfile,"r");
if (!f) {
@@ -584,8 +642,10 @@
return(0);
}
- if (status)
+ if (status) {
strcpy(status->message,"");
+ status->status = LPSTAT_OK;
+ }
while (fgets(line,sizeof(pstring),f))
{
@@ -597,6 +657,8 @@
count = 0;
break;
}
+
+ bzero((char *)(*queue),sizeof(**queue));
/* parse it */
if (!parse_lpq_entry(snum,line,&(*queue)[count],status,count==0))
@@ -650,7 +712,45 @@
ret = smbrun(syscmd,NULL);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
+ lpq_reset(snum); /* queue has changed */
}
+/****************************************************************************
+change status of a printer queue entry
+****************************************************************************/
+void status_printjob(int cnum,int snum,int jobid,int status)
+{
+ char *lpstatus_command =
+ (status==LPQ_PAUSED?lp_lppausecommand(snum):lp_lpresumecommand(snum));
+ char *printername = PRINTERNAME(snum);
+ pstring syscmd;
+ char jobstr[20];
+ int ret;
+
+ if (!printername || !*printername)
+ {
+ DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n",
+ lp_servicename(snum),snum));
+ printername = lp_servicename(snum);
+ }
+
+ if (!lpstatus_command || !(*lpstatus_command))
+ {
+ DEBUG(5,("No lpstatus command to %s job\n",
+ (status==LPQ_PAUSED?"pause":"resume")));
+ return;
+ }
+
+ sprintf(jobstr,"%d",jobid);
+
+ strcpy(syscmd,lpstatus_command);
+ string_sub(syscmd,"%p",printername);
+ string_sub(syscmd,"%j",jobstr);
+ standard_sub(cnum,syscmd);
+
+ ret = smbrun(syscmd,NULL);
+ DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
+ lpq_reset(snum); /* queue has changed */
+}
diff -u -r --new-file last-version/source/reply.c samba-1.9.14alpha17/source/reply.c
--- last-version/source/reply.c Tue Sep 12 20:00:26 1995
+++ samba-1.9.14alpha17/source/reply.c Fri Sep 15 21:53:20 1995
@@ -106,7 +106,32 @@
}
+/*******************************************************************
+work out what error to give to a failed connection
+********************************************************************/
+static int connection_error(char *inbuf,char *outbuf,int connection_num)
+{
+ switch (connection_num)
+ {
+ case -8:
+ return(ERROR(ERRSRV,ERRnoresource));
+ case -7:
+ return(ERROR(ERRSRV,ERRbaduid));
+ case -6:
+ return(ERROR(ERRSRV,ERRinvdevice));
+ case -5:
+ return(ERROR(ERRDOS,ERRbadpath));
+ case -4:
+ return(ERROR(ERRSRV,ERRaccess));
+ case -3:
+ return(ERROR(ERRDOS,ERRnoipc));
+ case -2:
+ return(ERROR(ERRSRV,ERRinvnetname));
+ }
+ return(ERROR(ERRSRV,ERRbadpw));
+}
+
/****************************************************************************
reply to a tcon
****************************************************************************/
@@ -131,17 +156,7 @@
connection_num = make_connection(service,user,password,pwlen,dev,vuid);
if (connection_num < 0)
- switch (connection_num)
- {
- case -4:
- return(ERROR(ERRSRV,ERRaccess));
- case -3:
- return(ERROR(ERRDOS,ERRnoipc));
- case -2:
- return(ERROR(ERRSRV,ERRinvnetname));
- default:
- return(ERROR(ERRSRV,ERRbadpw));
- }
+ return(connection_error(inbuf,outbuf,connection_num));
outsize = set_message(outbuf,2,0,True);
SSVAL(outbuf,smb_vwv0,maxxmit);
@@ -205,18 +220,8 @@
connection_num = make_connection(service,user,password,passlen,devicename,vuid);
if (connection_num < 0)
- switch (connection_num)
- {
- case -4:
- return(ERROR(ERRSRV,ERRaccess));
- case -3:
- return(ERROR(ERRDOS,ERRnoipc));
- case -2:
- return(ERROR(ERRSRV,ERRinvnetname));
- default:
- return(ERROR(ERRSRV,ERRbadpw));
- }
-
+ return(connection_error(inbuf,outbuf,connection_num));
+
outsize = set_message(outbuf,2,strlen(devicename)+1,True);
DEBUG(3,("%s tconX service=%s user=%s cnum=%d\n",timestring(),service,user,connection_num));
@@ -490,7 +495,7 @@
else
if (check_name(fname,cnum))
{
- if (stat(fname,&sbuf) == 0)
+ if (sys_stat(fname,&sbuf) == 0)
{
mode = dos_mode(cnum,fname,&sbuf);
size = sbuf.st_size;
@@ -575,7 +580,7 @@
cnum = SVAL(inbuf,smb_tid);
- disk_free(".",&bsize,&dfree,&dsize);
+ sys_disk_free(".",&bsize,&dfree,&dsize);
outsize = set_message(outbuf,5,0,True);
@@ -1147,7 +1152,7 @@
struct stat sbuf;
int fmode;
- if (lstat(fname,&sbuf) != 0) return(False);
+ if (sys_lstat(fname,&sbuf) != 0) return(False);
fmode = dos_mode(cnum,fname,&sbuf);
if (fmode & aDIR) return(False);
if (fmode & aRONLY) return(False);
@@ -1201,7 +1206,7 @@
if (!has_wild) {
strcat(directory,"/");
strcat(directory,mask);
- if (can_delete(directory,cnum,dirtype) && !unlink(directory)) count++;
+ if (can_delete(directory,cnum,dirtype) && !sys_unlink(directory)) count++;
} else {
void *dirptr = NULL;
char *dname;
@@ -1226,7 +1231,7 @@
error = ERRnoaccess;
sprintf(fname,"%s/%s",directory,dname);
if (!can_delete(fname,cnum,dirtype)) continue;
- if (!unlink(fname)) count++;
+ if (!sys_unlink(fname)) count++;
DEBUG(3,("reply_unlink : doing unlink on %s\n",fname));
}
CloseDir(dirptr);
@@ -2311,7 +2316,7 @@
unix_convert(directory,cnum);
if (check_name(directory,cnum))
- ret = mkdir(directory,unix_mode(cnum,aDIR));
+ ret = sys_mkdir(directory,unix_mode(cnum,aDIR));
if (ret < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess));
@@ -2341,7 +2346,7 @@
if (check_name(directory,cnum))
{
dptr_closepath(directory,SVAL(inbuf,smb_pid));
- ok = (rmdir(directory) == 0);
+ ok = (sys_rmdir(directory) == 0);
if (!ok)
DEBUG(3,("couldn't remove directory %s : %s\n",
directory,strerror(errno)));
@@ -2430,7 +2435,7 @@
struct stat sbuf;
int fmode;
- if (lstat(fname,&sbuf) != 0) return(False);
+ if (sys_lstat(fname,&sbuf) != 0) return(False);
fmode = dos_mode(cnum,fname,&sbuf);
if (fmode & aRONLY) return(False);
return(True);
@@ -2912,7 +2917,7 @@
unix_times.modtime += LOCAL_TO_GMT*TimeDiff(unix_times.modtime);
/* Set the date on this file */
- if(utime(Files[fnum].name, &unix_times))
+ if(sys_utime(Files[fnum].name, &unix_times))
return(ERROR(ERRDOS,ERRnoaccess));
DEBUG(3,("%s reply_setattrE fnum=%d cnum=%d\n",timestring(),fnum,cnum));
diff -u -r --new-file last-version/source/server.c samba-1.9.14alpha17/source/server.c
--- last-version/source/server.c Wed Sep 13 23:04:22 1995
+++ samba-1.9.14alpha17/source/server.c Fri Sep 15 21:38:57 1995
@@ -77,9 +77,6 @@
/* a fnum to use when chaining */
int chain_fnum = -1;
-/* what cnum we are currently working with */
-int current_cnum = -1;
-
/* number of open connections */
static int num_connections_open = 0;
@@ -204,7 +201,7 @@
int tmp;
int unixmode;
- if (stat(fname,&st)) return(-1);
+ if (sys_stat(fname,&st)) return(-1);
if (S_ISDIR(st.st_mode)) dosmode |= aDIR;
@@ -304,16 +301,24 @@
If the name looks like a mangled name then try via the mangling functions
****************************************************************************/
-static BOOL scan_directory(char *path, char *name,int snum)
+static BOOL scan_directory(char *path, char *name,int snum,BOOL docache)
{
void *cur_dir;
char *dname;
- BOOL mangled = is_mangled(name);
+ BOOL mangled;
+ fstring name2;
+
+ mangled = is_mangled(name);
/* handle null paths */
if (*path == 0)
path = ".";
+ if (docache && (dname = DirCacheCheck(path,name,snum))) {
+ strcpy(name, dname);
+ return(True);
+ }
+
if (mangled)
check_mangled_stack(name);
@@ -327,8 +332,6 @@
/* now scan for matching names */
while ((dname = ReadDirName(cur_dir)))
{
- fstring name2;
-
if (*dname == '.' &&
(strequal(dname,".") || strequal(dname,"..")))
continue;
@@ -339,6 +342,7 @@
|| fname_equal(name, name2))
{
/* we've found the file, change it's name and return */
+ if (docache) DirCacheAdd(path,name,dname,snum);
strcpy(name, dname);
CloseDir(cur_dir);
return(True);
@@ -393,7 +397,7 @@
}
/* stat the name - if it exists then we are all done! */
- if (stat(name,&st) == 0)
+ if (sys_stat(name,&st) == 0)
return(True);
DEBUG(5,("unix_convert(%s,%d)\n",name,cnum));
@@ -422,7 +426,7 @@
if (end) *end = 0;
/* check if the name exists up to this point */
- if (stat(name, &st) == 0)
+ if (sys_stat(name, &st) == 0)
{
/* it exists. it must either be a directory or this must be
the last part of the path for it to be OK */
@@ -447,7 +451,7 @@
/* try to find this part of the path in the directory */
if (strchr(start,'?') || strchr(start,'*') ||
- !scan_directory(dirpath, start, SNUM(cnum)))
+ !scan_directory(dirpath, start, SNUM(cnum), end?True:False))
{
if (end)
{
@@ -498,6 +502,328 @@
+
+#ifdef QUOTAS
+#ifndef CRAY
+/****************************************************************************
+try to get the disk space from disk quotas
+****************************************************************************/
+static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+{
+ uid_t user_id, euser_id;
+ int r;
+ char dev_disk[256];
+ struct dqblk D;
+ struct stat S;
+ /* find the block device file */
+ if ((stat(path, &S)<0) ||
+ (devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
+
+ euser_id = geteuid();
+
+#ifdef USE_SETRES
+ /* for HPUX, real uid must be same as euid to execute quotactl for euid */
+ user_id = getuid();
+ setresuid(euser_id,-1,-1);
+#endif
+ r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
+ #ifdef USE_SETRES
+ if (setresuid(user_id,-1,-1))
+ DEBUG(5,("Unable to reset uid to %d\n", user_id));
+ #endif
+ /* Use softlimit to determine disk space, except when it has been exceeded */
+ *bsize = 1024;
+ if (r)
+ {
+ if (errno == EDQUOT)
+ {
+ *dfree =0;
+ *dsize =D.dqb_curblocks;
+ return (True);
+ }
+ else return(False);
+ }
+ /* Use softlimit to determine disk space, except when it has been exceeded */
+ if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curfiles>D.dqb_fsoftlimit))
+ {
+ *dfree = 0;
+ *dsize = D.dqb_curblocks;
+ }
+ else {
+ *dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
+ *dsize = D.dqb_bsoftlimit;
+ }
+ return (True);
+}
+#else
+/****************************************************************************
+try to get the disk space from disk quotas (CRAY VERSION)
+****************************************************************************/
+static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+{
+ struct mntent *mnt;
+ FILE *fd;
+ struct stat sbuf;
+ dev_t devno ;
+ static dev_t devno_cached = 0 ;
+ static char name[MNTMAXSTR] ;
+ struct q_request request ;
+ struct qf_header header ;
+ static int quota_default = 0 ;
+ int found ;
+
+ if ( stat(path,&sbuf) == -1 )
+ return(False) ;
+
+ devno = sbuf.st_dev ;
+
+ if ( devno != devno_cached ) {
+
+ devno_cached = devno ;
+
+ if ((fd = setmntent(KMTAB)) == NULL)
+ return(False) ;
+
+ found = False ;
+
+ while ((mnt = getmntent(fd)) != NULL) {
+
+ if ( stat(mnt->mnt_dir,&sbuf) == -1 )
+ continue ;
+
+ if (sbuf.st_dev == devno) {
+
+ found = True ;
+ break ;
+
+ }
+
+ }
+
+ strcpy(name,mnt->mnt_dir) ;
+ endmntent(fd) ;
+
+ if ( ! found )
+ return(False) ;
+ }
+
+ request.qf_magic = QF_MAGIC ;
+ request.qf_entry.id = geteuid() ;
+
+ if (quotactl(name, Q_GETQUOTA, &request) == -1)
+ return(False) ;
+
+ if ( ! request.user )
+ return(False) ;
+
+ if ( request.qf_entry.user_q.f_quota == QFV_DEFAULT ) {
+
+ if ( ! quota_default ) {
+
+ if ( quotactl(name, Q_GETHEADER, &header) == -1 )
+ return(False) ;
+ else
+ quota_default = header.user_h.def_fq ;
+ }
+
+ *dfree = quota_default ;
+
+ }else if ( request.qf_entry.user_q.f_quota == QFV_PREVENT ) {
+
+ *dfree = 0 ;
+
+ }else{
+
+ *dfree = request.qf_entry.user_q.f_quota ;
+
+ }
+
+ *dsize = request.qf_entry.user_q.f_use ;
+
+ if ( *dfree )
+ *dfree -= *dsize ;
+
+ if ( *dfree < 0 )
+ *dfree = 0 ;
+
+ *bsize = 4096 ; /* Cray blocksize */
+
+ return(True) ;
+
+}
+#endif /* CRAY */
+#endif /* QUOTAS */
+
+
+/****************************************************************************
+normalise for DOS usage
+****************************************************************************/
+static void disk_norm(int *bsize,int *dfree,int *dsize)
+{
+ /* check if the disk is beyond the max disk size */
+ int maxdisksize = lp_maxdisksize();
+ if (maxdisksize) {
+ /* convert to blocks - and don't overflow */
+ maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
+ if (*dsize > maxdisksize) *dsize = maxdisksize;
+ if (*dfree > maxdisksize) *dfree = maxdisksize-1; /* the -1 should stop
+ applications getting
+ div by 0 errors */
+ }
+
+ while (*dfree > WORDMAX || *dsize > WORDMAX || *bsize < 512)
+ {
+ *dfree /= 2;
+ *dsize /= 2;
+ *bsize *= 2;
+ if (*bsize > WORDMAX )
+ {
+ *bsize = WORDMAX;
+ if (*dsize > WORDMAX)
+ *dsize = WORDMAX;
+ if (*dfree > WORDMAX)
+ *dfree = WORDMAX;
+ break;
+ }
+ }
+}
+
+/****************************************************************************
+ return number of 1K blocks available on a path and total number
+****************************************************************************/
+int disk_free(char *path,int *bsize,int *dfree,int *dsize)
+{
+ char *df_command = lp_dfree_command();
+#ifdef USE_STATVFS
+ struct statvfs fs;
+#else
+#ifdef ULTRIX
+ struct fs_data fs;
+#else
+ struct statfs fs;
+#endif
+#endif
+
+#ifdef QUOTAS
+ if (disk_quotas(path, bsize, dfree, dsize))
+ {
+ disk_norm(bsize,dfree,dsize);
+ return(((*bsize)/1024)*(*dfree));
+ }
+#endif
+
+
+ /* possibly use system() to get the result */
+ if (df_command && *df_command)
+ {
+ int ret;
+ pstring syscmd;
+ pstring outfile;
+
+ sprintf(outfile,"/tmp/dfree.smb.%d",(int)getpid());
+ sprintf(syscmd,"%s %s",df_command,path);
+ standard_sub_basic(syscmd);
+
+ ret = smbrun(syscmd,outfile);
+ DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
+
+ {
+ FILE *f = fopen(outfile,"r");
+ *dsize = 0;
+ *dfree = 0;
+ *bsize = 1024;
+ if (f)
+ {
+ fscanf(f,"%d %d %d",dsize,dfree,bsize);
+ fclose(f);
+ }
+ else
+ DEBUG(0,("Can't open %s\n",outfile));
+ }
+
+ unlink(outfile);
+ disk_norm(bsize,dfree,dsize);
+ return(((*bsize)/1024)*(*dfree));
+ }
+
+
+#ifdef STATFS4
+ if (statfs(path,&fs,sizeof(fs),0) != 0)
+#else
+#ifdef USE_STATVFS
+ if (statvfs(path, &fs))
+#else
+#ifdef STATFS3
+ if (statfs(path,&fs,sizeof(fs)) == -1)
+#else
+ if (statfs(path,&fs) == -1)
+#endif /* STATFS3 */
+#endif /* USE_STATVFS */
+#endif /* STATFS4 */
+ {
+ DEBUG(3,("dfree call failed code errno=%d\n",errno));
+ *bsize = 1024;
+ *dfree = 1;
+ *dsize = 1;
+ return(((*bsize)/1024)*(*dfree));
+ }
+
+#ifdef ULTRIX
+ *bsize = 1024;
+ *dfree = fs.fd_req.bfree;
+ *dsize = fs.fd_req.btot;
+#else
+#ifdef USE_STATVFS
+ *bsize = fs.f_frsize;
+#else
+#ifdef USE_F_FSIZE
+ /* eg: osf1 has f_fsize = fundamental filesystem block size,
+ f_bsize = optimal transfer block size (MX: 94-04-19) */
+ *bsize = fs.f_fsize;
+#else
+ *bsize = fs.f_bsize;
+#endif /* STATFS3 */
+#endif /* USE_STATVFS */
+
+#ifdef STATFS4
+ *dfree = fs.f_bfree;
+#else
+ *dfree = fs.f_bavail;
+#endif /* STATFS4 */
+ *dsize = fs.f_blocks;
+#endif /* ULTRIX */
+
+#if defined(SCO) || defined(ISC) || defined(MIPS)
+ *bsize = 512;
+#endif
+
+/* handle rediculous bsize values - some OSes are broken */
+if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024;
+
+ disk_norm(bsize,dfree,dsize);
+
+ if (*bsize < 256)
+ *bsize = 512;
+ if ((*dsize)<1)
+ {
+ DEBUG(0,("dfree seems to be broken on your system\n"));
+ *dsize = 20*1024*1024/(*bsize);
+ *dfree = MAX(1,*dfree);
+ }
+ return(((*bsize)/1024)*(*dfree));
+}
+
+
+/****************************************************************************
+wrap it to get filenames right
+****************************************************************************/
+int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize)
+{
+ return(disk_free(dos_to_unix(path,False),bsize,dfree,dsize));
+}
+
+
+
/****************************************************************************
check a filename - possibly caling reducename
@@ -569,11 +895,11 @@
/* XXXX - is this OK?? */
/* this works around a utime bug but can cause other problems */
if ((flags & (O_WRONLY|O_RDWR)) && (flags & O_CREAT) && !(flags & O_APPEND))
- unlink(fname);
+ sys_unlink(fname);
#endif
- Files[fnum].fd = open(fname,flags,mode);
+ Files[fnum].fd = sys_open(fname,flags,mode);
if ((Files[fnum].fd>=0) &&
Connections[cnum].printer && lp_minprintspace(SNUM(cnum))) {
@@ -583,10 +909,11 @@
strcpy(dname,fname);
p = strrchr(dname,'/');
if (p) *p = 0;
- if (disk_free(dname,&dum1,&dum2,&dum3) < lp_minprintspace(SNUM(cnum))) {
+ if (sys_disk_free(dname,&dum1,&dum2,&dum3) <
+ lp_minprintspace(SNUM(cnum))) {
close(Files[fnum].fd);
Files[fnum].fd = -1;
- unlink(fname);
+ sys_unlink(fname);
errno = ENOSPC;
return;
}
@@ -598,7 +925,7 @@
(strchr(fname,'.')==NULL))
{
strcat(fname,".");
- Files[fnum].fd = open(fname,flags,mode);
+ Files[fnum].fd = sys_open(fname,flags,mode);
}
#if (defined(ENAMETOOLONG) && defined(HAVE_PATHCONF))
@@ -629,7 +956,7 @@
char tmp = p[max_len];
p[max_len] = '\0';
- if ((Files[fnum].fd = open(fname,flags,mode)) == -1)
+ if ((Files[fnum].fd = sys_open(fname,flags,mode)) == -1)
p[max_len] = tmp;
}
}
@@ -1119,8 +1446,6 @@
snum = SNUM(cnum);
- current_cnum = cnum;
-
if (do_chdir &&
ChDir(Connections[cnum].connectpath) != 0 &&
ChDir(Connections[cnum].origpath) != 0)
@@ -1297,6 +1622,7 @@
if (!become_gid(gid_to_become))
return(False);
+#ifndef NO_SETGROUPS
if (!IS_IPC(cnum))
{
/* groups stuff added by ih/wreu */
@@ -1304,6 +1630,7 @@
if (setgroups(vuser->user_ngroups,(GID_TYPE *)vuser->user_groups)<0)
DEBUG(0,("setgroups call failed!\n"));
}
+#endif
if (!Connections[cnum].admin_user && !become_uid(vuser->uid))
return(False);
@@ -1318,13 +1645,15 @@
if (!become_gid(Connections[cnum].gid))
return(False);
- if (!IS_IPC(cnum))
+#ifndef NO_SETGROUPS
+ if (!IS_IPC(cnum))
{
/* groups stuff added by ih/wreu */
if (Connections[cnum].ngroups > 0)
if (setgroups(Connections[cnum].ngroups,(GID_TYPE *)Connections[cnum].groups)<0)
DEBUG(0,("setgroups call failed!\n"));
}
+#endif
if (!Connections[cnum].admin_user && !become_uid(Connections[cnum].uid))
return(False);
@@ -1941,7 +2270,7 @@
if (groups_use_ints)
{
*p_igroups = igroups;
- *p_groups = (gid_t *)igroups;
+ *p_groups = (GID_TYPE *)igroups;
}
else
{
@@ -1950,7 +2279,7 @@
for (i=0;i<ngroups;i++)
igroups[i] = groups[i];
*p_igroups = igroups;
- *p_groups = groups;
+ *p_groups = (GID_TYPE *)groups;
}
}
DEBUG(3,("%s is in %d groups\n",user,ngroups));
@@ -2001,7 +2330,7 @@
}
if (!lp_snum_ok(snum) || !check_access(snum))
- return(-1);
+ return(-4);
/* you can only connect to the IPC$ service as an ipc device */
if (strequal(service,"IPC$"))
@@ -2018,7 +2347,7 @@
/* if the request is as a printer and you can't print then refuse */
strupper(dev);
if (!lp_print_ok(snum) && (strncmp(dev,"LPT",3) == 0))
- return(-2);
+ return(-6);
/* lowercase the user name */
strlower(user);
@@ -2048,7 +2377,7 @@
if (pass == NULL)
{
DEBUG(0,("%s couldn't find account %s\n",timestring(),user));
- return(-1);
+ return(-7);
}
pcon->read_only = lp_readonly(snum);
@@ -2136,7 +2465,7 @@
lp_max_connections(SNUM(cnum)),False))
{
DEBUG(1,("too many connections - rejected\n"));
- return(-4);
+ return(-8);
}
if (lp_status(SNUM(cnum)))
@@ -2168,7 +2497,7 @@
{
DEBUG(0,("Can't change directory to %s\n",pcon->connectpath));
pcon->open = False;
- return(-1);
+ return(-5);
}
string_set(&pcon->origpath,pcon->connectpath);
@@ -2556,303 +2885,6 @@
}
}
-#ifdef QUOTAS
-#ifndef CRAY
-/****************************************************************************
-try to get the disk space from disk quotas
-****************************************************************************/
-static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
-{
- uid_t user_id, euser_id;
- char dev_disk[256];
- struct dqblk D;
- struct stat S;
- /* find the block device file */
- if ((stat(path, &S)<0) ||
- (devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
-
- euser_id = geteuid();
-
-#ifdef USE_SETRES
- /* for HPUX, real uid must be same as euid to execute quotactl for euid */
- user_id = getuid();
- setresuid(euser_id,-1,-1);
-#endif
- if (quotactl(Q_GETQUOTA, dev_disk, euser_id, &D)<0) return (False);
-#ifdef USE_SETRES
- setresuid(user_id,-1,-1);
-#endif
- /* Use softlimit to determine disk space, except when it has been exceeded */
- *bsize = 1024;
- if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curfiles>D.dqb_fsoftlimit))
- {
- *dfree = 0;
- *dsize = D.dqb_curblocks;
- }
- else {
- *dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
- *dsize = D.dqb_bsoftlimit;
- }
- return (True);
-}
-#else
-/****************************************************************************
-try to get the disk space from disk quotas (CRAY VERSION)
-****************************************************************************/
-static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
-{
- struct mntent *mnt;
- FILE *fd;
- struct stat sbuf;
- dev_t devno ;
- static dev_t devno_cached = 0 ;
- static char name[MNTMAXSTR] ;
- struct q_request request ;
- struct qf_header header ;
- static int quota_default = 0 ;
- int found ;
-
- if ( stat(path,&sbuf) == -1 )
- return(False) ;
-
- devno = sbuf.st_dev ;
-
- if ( devno != devno_cached ) {
-
- devno_cached = devno ;
-
- if ((fd = setmntent(KMTAB)) == NULL)
- return(False) ;
-
- found = False ;
-
- while ((mnt = getmntent(fd)) != NULL) {
-
- if ( stat(mnt->mnt_dir,&sbuf) == -1 )
- continue ;
-
- if (sbuf.st_dev == devno) {
-
- found = True ;
- break ;
-
- }
-
- }
-
- strcpy(name,mnt->mnt_dir) ;
- endmntent(fd) ;
-
- if ( ! found )
- return(False) ;
- }
-
- request.qf_magic = QF_MAGIC ;
- request.qf_entry.id = geteuid() ;
-
- if (quotactl(name, Q_GETQUOTA, &request) == -1)
- return(False) ;
-
- if ( ! request.user )
- return(False) ;
-
- if ( request.qf_entry.user_q.f_quota == QFV_DEFAULT ) {
-
- if ( ! quota_default ) {
-
- if ( quotactl(name, Q_GETHEADER, &header) == -1 )
- return(False) ;
- else
- quota_default = header.user_h.def_fq ;
- }
-
- *dfree = quota_default ;
-
- }else if ( request.qf_entry.user_q.f_quota == QFV_PREVENT ) {
-
- *dfree = 0 ;
-
- }else{
-
- *dfree = request.qf_entry.user_q.f_quota ;
-
- }
-
- *dsize = request.qf_entry.user_q.f_use ;
-
- if ( *dfree )
- *dfree -= *dsize ;
-
- if ( *dfree < 0 )
- *dfree = 0 ;
-
- *bsize = 4096 ; /* Cray blocksize */
-
- return(True) ;
-
-}
-#endif /* CRAY */
-#endif /* QUOTAS */
-
-
-/****************************************************************************
-normalise for DOS usage
-****************************************************************************/
-static void disk_norm(int *bsize,int *dfree,int *dsize)
-{
- /* check if the disk is beyond the max disk size */
- int maxdisksize = lp_maxdisksize();
- if (maxdisksize) {
- /* convert to blocks - and don't overflow */
- maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
- if (*dsize > maxdisksize) *dsize = maxdisksize;
- if (*dfree > maxdisksize) *dfree = maxdisksize-1; /* the -1 should stop
- applications getting
- div by 0 errors */
- }
-
- while (*dfree > WORDMAX || *dsize > WORDMAX || *bsize < 512)
- {
- *dfree /= 2;
- *dsize /= 2;
- *bsize *= 2;
- if (*bsize > WORDMAX )
- {
- *bsize = WORDMAX;
- if (*dsize > WORDMAX)
- *dsize = WORDMAX;
- if (*dfree > WORDMAX)
- *dfree = WORDMAX;
- break;
- }
- }
-}
-
-/****************************************************************************
- return number of 1K blocks available on a path and total number
-****************************************************************************/
-int disk_free(char *path,int *bsize,int *dfree,int *dsize)
-{
- char *df_command = lp_dfree_command();
-#ifdef USE_STATVFS
- struct statvfs fs;
-#else
-#ifdef ULTRIX
- struct fs_data fs;
-#else
- struct statfs fs;
-#endif
-#endif
-
-#ifdef QUOTAS
- if (disk_quotas(path, bsize, dfree, dsize))
- {
- disk_norm(bsize,dfree,dsize);
- return(((*bsize)/1024)*(*dfree));
- }
-#endif
-
-
- /* possibly use system() to get the result */
- if (df_command && *df_command)
- {
- int ret;
- pstring syscmd;
- pstring outfile;
-
- sprintf(outfile,"/tmp/dfree.smb.%d",(int)getpid());
- sprintf(syscmd,"%s %s",df_command,path);
- standard_sub(current_cnum,syscmd);
-
- ret = smbrun(syscmd,outfile);
- DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
-
- {
- FILE *f = fopen(outfile,"r");
- *dsize = 0;
- *dfree = 0;
- *bsize = 1024;
- if (f)
- {
- fscanf(f,"%d %d %d",dsize,dfree,bsize);
- fclose(f);
- }
- else
- DEBUG(0,("Can't open %s\n",outfile));
- }
-
- unlink(outfile);
- disk_norm(bsize,dfree,dsize);
- return(((*bsize)/1024)*(*dfree));
- }
-
-
-#ifdef STATFS4
- if (statfs(path,&fs,sizeof(fs),0) != 0)
-#else
-#ifdef USE_STATVFS
- if (statvfs(path, &fs))
-#else
-#ifdef STATFS3
- if (statfs(path,&fs,sizeof(fs)) == -1)
-#else
- if (statfs(path,&fs) == -1)
-#endif /* STATFS3 */
-#endif /* USE_STATVFS */
-#endif /* STATFS4 */
- {
- DEBUG(3,("dfree call failed code errno=%d\n",errno));
- *bsize = 1024;
- *dfree = 1;
- *dsize = 1;
- return(((*bsize)/1024)*(*dfree));
- }
-
-#ifdef ULTRIX
- *bsize = 1024;
- *dfree = fs.fd_req.bfree;
- *dsize = fs.fd_req.btot;
-#else
-#ifdef USE_STATVFS
- *bsize = fs.f_frsize;
-#else
-#ifdef USE_F_FSIZE
- /* eg: osf1 has f_fsize = fundamental filesystem block size,
- f_bsize = optimal transfer block size (MX: 94-04-19) */
- *bsize = fs.f_fsize;
-#else
- *bsize = fs.f_bsize;
-#endif /* STATFS3 */
-#endif /* USE_STATVFS */
-
-#ifdef STATFS4
- *dfree = fs.f_bfree;
-#else
- *dfree = fs.f_bavail;
-#endif /* STATFS4 */
- *dsize = fs.f_blocks;
-#endif /* ULTRIX */
-
-#if defined(SCO) || defined(ISC) || defined(MIPS)
- *bsize = 512;
-#endif
-
-/* handle rediculous bsize values - some OSes are broken */
-if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024;
-
- disk_norm(bsize,dfree,dsize);
-
- if (*bsize < 256)
- *bsize = 512;
- if ((*dsize)<1)
- {
- DEBUG(0,("dfree seems to be broken on your system\n"));
- *dsize = 20*1024*1024/(*bsize);
- *dfree = MAX(1,*dfree);
- }
- return(((*bsize)/1024)*(*dfree));
-}
-
/****************************************************************************
close all open files for a connection
@@ -2874,6 +2906,8 @@
void close_cnum(int cnum, int uid)
{
extern struct from_host Client_info;
+
+ DirCacheFlush(SNUM(cnum));
unbecome_user();
diff -u -r --new-file last-version/source/smb.h samba-1.9.14alpha17/source/smb.h
--- last-version/source/smb.h Tue Sep 12 20:02:54 1995
+++ samba-1.9.14alpha17/source/smb.h Fri Sep 15 21:14:23 1995
@@ -295,6 +295,7 @@
int job;
int size;
int status;
+ int priority;
time_t time;
char user[30];
char file[100];
@@ -561,6 +562,21 @@
/* and a few prototypes */
int sys_select(fd_set *fds,struct timeval *tval);
+int sys_unlink(char *fname);
+int sys_open(char *fname,int flags,int mode);
+DIR *sys_opendir(char *dname);
+int sys_stat(char *fname,struct stat *sbuf);
+int sys_lstat(char *fname,struct stat *sbuf);
+int sys_mkdir(char *dname,int mode);
+int sys_rmdir(char *dname);
+int sys_chdir(char *dname);
+int sys_utime(char *fname,struct utimbuf *times);
+int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
+void lpq_reset(int);
+void status_printjob(int cnum,int snum,int jobid,int status);
+void DirCacheAdd(char *path,char *name,char *dname,int snum);
+char *DirCacheCheck(char *path,char *name,int snum);
+void DirCacheFlush(int snum);
int interpret_character_set(char *str, int def);
char *dos2unix_format(char *, BOOL);
char *unix2dos_format(char *, BOOL);
diff -u -r --new-file last-version/source/system.c samba-1.9.14alpha17/source/system.c
--- last-version/source/system.c Tue Sep 12 16:14:57 1995
+++ samba-1.9.14alpha17/source/system.c Fri Sep 15 21:18:15 1995
@@ -28,6 +28,8 @@
- to enable easier porting by putting OS dependent stuff in here
- to allow for hooks into other "pseudo-filesystems"
+
+ - to allow easier integration of things like the japanese extensions
*/
@@ -100,3 +102,83 @@
return(selrtn);
}
#endif
+
+
+/*******************************************************************
+just a unlink wrapper
+********************************************************************/
+int sys_unlink(char *fname)
+{
+ return(unlink(dos_to_unix(fname,False)));
+}
+
+
+/*******************************************************************
+a simple open() wrapper
+********************************************************************/
+int sys_open(char *fname,int flags,int mode)
+{
+ return(open(dos_to_unix(fname,False),flags,mode));
+}
+
+
+/*******************************************************************
+a simple opendir() wrapper
+********************************************************************/
+DIR *sys_opendir(char *dname)
+{
+ return(opendir(dos_to_unix(dname,False)));
+}
+
+
+/*******************************************************************
+and a stat() wrapper
+********************************************************************/
+int sys_stat(char *fname,struct stat *sbuf)
+{
+ return(stat(dos_to_unix(fname,False),sbuf));
+}
+
+/*******************************************************************
+don't forget lstat()
+********************************************************************/
+int sys_lstat(char *fname,struct stat *sbuf)
+{
+ return(lstat(dos_to_unix(fname,False),sbuf));
+}
+
+
+/*******************************************************************
+mkdir() gets a wrapper
+********************************************************************/
+int sys_mkdir(char *dname,int mode)
+{
+ return(mkdir(dos_to_unix(dname,False),mode));
+}
+
+
+/*******************************************************************
+do does rmdir()
+********************************************************************/
+int sys_rmdir(char *dname)
+{
+ return(rmdir(dos_to_unix(dname,False)));
+}
+
+
+/*******************************************************************
+I almost forgot chdir()
+********************************************************************/
+int sys_chdir(char *dname)
+{
+ return(chdir(dos_to_unix(dname,False)));
+}
+
+
+/*******************************************************************
+now for utime()
+********************************************************************/
+int sys_utime(char *fname,struct utimbuf *times)
+{
+ return(utime(dos_to_unix(fname,False),times));
+}
diff -u -r --new-file last-version/source/trans2.c samba-1.9.14alpha17/source/trans2.c
--- last-version/source/trans2.c Tue Sep 12 21:27:13 1995
+++ samba-1.9.14alpha17/source/trans2.c Fri Sep 15 21:21:00 1995
@@ -312,7 +312,7 @@
strcpy(pathreal,Connections[cnum].dirpath);
strcat(pathreal,"/");
strcat(pathreal,fname);
- if (stat(pathreal,&sbuf) != 0)
+ if (sys_stat(pathreal,&sbuf) != 0)
{
DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno)));
continue;
@@ -866,7 +866,7 @@
DEBUG(3,("call_trans2qfsinfo: cnum = %d, level = %d\n", cnum, info_level));
- if(stat(".",&st)!=0) {
+ if(sys_stat(".",&st)!=0) {
DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno)));
return (ERROR(ERRSRV,ERRinvdevice));
}
@@ -879,7 +879,7 @@
{
int dfree,dsize,bsize;
data_len = 18;
- disk_free(".",&bsize,&dfree,&dsize);
+ sys_disk_free(".",&bsize,&dfree,&dsize);
SIVAL(pdata,l1_idFileSystem,st.st_dev);
SIVAL(pdata,l1_cSectorUnit,bsize/512);
SIVAL(pdata,l1_cUnit,dsize);
@@ -922,7 +922,7 @@
{
int dfree,dsize,bsize;
data_len = 24;
- disk_free(".",&bsize,&dfree,&dsize);
+ sys_disk_free(".",&bsize,&dfree,&dsize);
SIVAL(pdata,0,dsize);
SIVAL(pdata,8,dfree);
SIVAL(pdata,16,bsize/512);
@@ -1004,7 +1004,7 @@
fname = &fname1[0];
strcpy(fname,¶ms[6]);
unix_convert(fname,cnum);
- if (!check_name(fname,cnum) || stat(fname,&sbuf)) {
+ if (!check_name(fname,cnum) || sys_stat(fname,&sbuf)) {
DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno)));
return(UNIXERROR(ERRDOS,ERRbadpath));
}
@@ -1183,7 +1183,7 @@
if(!check_name(fname, cnum))
return(ERROR(ERRDOS,ERRbadpath));
- if(stat(fname,&st)!=0) {
+ if(sys_stat(fname,&st)!=0) {
DEBUG(3,("stat of %s failed (%s)\n", fname, strerror(errno)));
return(ERROR(ERRDOS,ERRbadpath));
}
@@ -1263,7 +1263,7 @@
/* Try and set the times, size and mode of this file - if they are different
from the current values */
if(st.st_mtime != tvs.modtime || st.st_atime != tvs.actime) {
- if(utime(fname, &tvs)!=0)
+ if(sys_utime(fname, &tvs)!=0)
return(ERROR(ERRDOS,ERRnoaccess));
}
if(mode != dos_mode(cnum,fname,&st) && dos_chmod(cnum,fname,mode)) {
@@ -1272,7 +1272,7 @@
}
if(size != st.st_size) {
if (fd == -1) {
- fd = open(fname,O_RDWR);
+ fd = sys_open(fname,O_RDWR,0);
if (fd == -1)
return(ERROR(ERRDOS,ERRbadpath));
set_filelen(fd, size);
@@ -1308,7 +1308,7 @@
unix_convert(directory,cnum);
if (check_name(directory,cnum))
- ret = mkdir(directory,unix_mode(cnum,aDIR));
+ ret = sys_mkdir(directory,unix_mode(cnum,aDIR));
if(ret < 0)
{
diff -u -r --new-file last-version/source/ufc.c samba-1.9.14alpha17/source/ufc.c
--- last-version/source/ufc.c Sat Apr 15 20:30:24 1995
+++ samba-1.9.14alpha17/source/ufc.c Thu Sep 14 17:16:06 1995
@@ -10,6 +10,10 @@
Under SunOS I found a huge speedup by using these routines
(a factor of 20 or so)
+ Warning: I've had a report from Steve Kennedy <steve@gbnet.org>
+ that this crypt routine may sometimes get the wrong answer. Only
+ use UFC_CRYT if you really need it.
+
*/
#ifdef UFC_CRYPT
diff -u -r --new-file last-version/source/util.c samba-1.9.14alpha17/source/util.c
--- last-version/source/util.c Tue Sep 12 21:02:39 1995
+++ samba-1.9.14alpha17/source/util.c Fri Sep 15 21:06:29 1995
@@ -751,7 +751,7 @@
struct stat st;
if (!sbuf) sbuf = &st;
- if (stat(fname,sbuf) != 0)
+ if (sys_stat(fname,sbuf) != 0)
return(False);
return(S_ISREG(sbuf->st_mode));
@@ -764,7 +764,7 @@
{
struct stat st;
- if (stat(fname,&st) != 0)
+ if (sys_stat(fname,&st) != 0)
return(0);
return(st.st_mtime);
@@ -777,7 +777,7 @@
{
struct stat st;
- if (stat(dname,&st) != 0)
+ if (sys_stat(dname,&st) != 0)
return(False);
return(S_ISDIR(st.st_mode));
@@ -790,7 +790,7 @@
{
struct stat buf;
buf.st_size = 0;
- stat(file_name,&buf);
+ sys_stat(file_name,&buf);
return(buf.st_size);
}
@@ -1312,7 +1312,7 @@
if (*path == '/' && strcsequal(LastDir,path)) return(0);
DEBUG(3,("chdir to %s\n",path));
strcpy(LastDir,path);
- return(chdir(path));
+ return(sys_chdir(path));
}
@@ -3225,7 +3225,7 @@
times.modtime = times.actime = mtime;
- if (utime(fname,×)) {
+ if (sys_utime(fname,×)) {
DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno)));
}
@@ -3849,14 +3849,25 @@
BOOL process_exists(int pid)
{
#ifdef LINUX
- pstring s;
+ fstring s;
sprintf(s,"/proc/%d",pid);
return(directory_exist(s));
-#elif defined(SUNOS5)
- pstring s;
- sprintf(s,"/proc/%05d",pid);
- return(file_exist(s,NULL));
#else
+ {
+ static BOOL tested=False;
+ static BOOL ok=False;
+ fstring s;
+ if (!tested) {
+ tested = True;
+ sprintf(s,"/proc/%05d",getpid());
+ ok = file_exist(s,NULL);
+ }
+ if (ok) {
+ sprintf(s,"/proc/%05d",pid);
+ return(file_exist(s,NULL));
+ }
+ }
+
/* a best guess for non root access */
if (geteuid() != 0) return(True);
diff -u -r --new-file last-version/source/version.h samba-1.9.14alpha17/source/version.h
--- last-version/source/version.h Thu Sep 14 00:12:21 1995
+++ samba-1.9.14alpha17/source/version.h Fri Sep 15 22:24:01 1995
@@ -1 +1 @@
-#define VERSION "1.9.14alpha16"
+#define VERSION "1.9.14alpha17"